pedroSG94 / RootEncoder

RootEncoder for Android (rtmp-rtsp-stream-client-java) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP, SRT and UDP with all code written in Java/Kotlin
Apache License 2.0
2.58k stars 781 forks source link

Reconnect the stream in previous URL when internet connection interrupts or switch from wifi to gsm or vice versa. #1523

Open RedwanSharafatKabir opened 4 months ago

RedwanSharafatKabir commented 4 months ago

I am streaming in a URL that only allows one stream. But if the internet disconnects the stream from the Application side, stops. And streaming on the URL also stops. How to re-stream when the internet is restored.

pedroSG94 commented 4 months ago

Hello,

You can do a reconnection like here: https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/rotation/CameraFragment.kt#L199 Remember add the number of retries: https://github.com/pedroSG94/RootEncoder/blob/master/app/src/main/java/com/pedro/streamer/rotation/CameraFragment.kt#L171

If you want connect to other url you can replace the null value of the first link to your new url

RedwanSharafatKabir commented 4 months ago

Its working great now. Thanks a lot for your fast reply.