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.54k stars 772 forks source link

when switch network "Error configure stream, Unimplemented message type: null" this error occurre #1152

Closed hemant-novotrax closed 7 months ago

hemant-novotrax commented 2 years ago

When I try to switch to another network(like one Wi-Fi to another Wi-Fi or device internet), the RTMP stream can't reconnect to the server. and many times they cant reconnect to the same network.

E/RtmpClient: connection error
    java.io.IOException: Unimplemented message type: null
        at com.pedro.rtmp.rtmp.message.RtmpMessage$Companion.getRtmpMessage(RtmpMessage.kt:68)
        at com.pedro.rtmp.rtmp.CommandsManager.readMessageResponse(CommandsManager.kt:175)
        at com.pedro.rtmp.rtmp.RtmpClient.handleMessages(RtmpClient.kt:293)
        at com.pedro.rtmp.rtmp.RtmpClient.connect$lambda-0(RtmpClient.kt:196)
        at com.pedro.rtmp.rtmp.RtmpClient.$r8$lambda$2Ex0pWOcGVHPFRJWQRhtgifpZyQ(Unknown Source:0)
        at com.pedro.rtmp.rtmp.RtmpClient$$ExternalSyntheticLambda0.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:920)
2022-07-01 15:13:48.719 19633-24169/com.novotraxcorp.livebodycampro E/reason:-->: Error configure stream, Unimplemented message type: null

and I already used:-

 @Override
    public void onConnectionFailedRtp(@Nullable String reason, @Nullable Camera2Base camera2Base) {
        Log.e("reason:-->", "" + reason);
        this.camera2Base = camera2Base;
        runOnUiThread(() -> {
            assert camera2Base != null;
            if (camera2Base.reTry(5000, reason, finalRtmpUrl)) {
                Toast.makeText(BaseActivity.this, "Retry", Toast.LENGTH_SHORT)
                        .show();
            } else {
                Toast.makeText(BaseActivity.this, "Connection failed. " + reason, Toast.LENGTH_SHORT)
                        .show();
            }
        });
    }

I am using node-media-server for streaming.

pedroSG94 commented 2 years ago

Hello,

I can't reproduce the case using a local server. I'm connecting using wifi and turn off / on wifi to reconnect. I used your server with docker version.

How many reconnect are you doing? Maybe you need wait a bit more so you need more attempts.

pedroSG94 commented 7 months ago

Closing as inactive.