opentok / opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.
https://tokbox.com/developer/sdks/android/
MIT License
210 stars 169 forks source link

Android client gets disconnected from the call after switch from Mobile data to WiFi #437

Closed gab07 closed 8 months ago

gab07 commented 1 year ago

Describe the bug Switching networks during a call will disconnect the user from the call.

To Reproduce

Expected behavior Android client should be able to reconnect to the call after switching networks.

Device (please compete the following information):

v-kpheng commented 1 year ago

Thanks, @gab07, for filing this issue.

Are you able to reproduce using the latest version of the SDK?

gab07 commented 1 year ago

I just reproduced it usingv2.23.1. I've found this article and after reading it I'm not sure if this is a bug or intended behavior.

v-kpheng commented 1 year ago

Thanks, @gab07. I think the article is outdated. I'll look into getting it updated 🤞.

In any case, switching from cellular to WiFi should work.

v-kpheng commented 1 year ago

https://jira.vonage.com/browse/OPENTOK-49285

goncalocostamendes commented 11 months ago

@gab07 just tried it out in our latest version v2.25.3 and the app automatically reconnects when switching networks. Can you tried it out? In case automatically network handover is not successful, does your app crashes or the client just disconnects from the session and you are required to join the session again?

gab07 commented 11 months ago

@goncalocostamendes Hey, I re-tested this issue using the Basic-Video-Chat-Kotlin example from this repo and I've found that after switching from Data to WiFi:

Notes:

Answering your question, the mobile client doesn't crash but it is required to rejoin because it gets disconnected from the call.

goncalocostamendes commented 11 months ago

Hi @gab07! I have tried to reproduce your Use Case, but without success. Both with relayed and routed sessions.

The behaviour you describe is consistent with tipical publisher timeout after stream dropped. The timeout is always 15 seconds after network is disconnected.

Our network reconnection logic provides some logs if enabled that can provide us some insights on why the publisher is disconnecting. Would it be possible for you to enable advanced logging (with the following code) to the log file and provide it?

override fun onCreate(savedInstanceState: Bundle?) {
        ...
        com.opentok.android.OpenTokConfig.setJNILogs(true);
        com.opentok.android.OpenTokConfig.setOTKitLogs(true);
        com.opentok.android.OpenTokConfig.setWebRTCLogs(true);
    }
gab07 commented 11 months ago

These are the logs that I've got. There were a lot of text, I'm not sure if I've got it right.

logs.txt

goncalocostamendes commented 10 months ago

@gab07 I had a change to look into the logs. Was this the full log file? I ask because the logs only report 11 seconds of the session, but I can see the session was much longer.

However it is possible to see that the session was not able to connect in a bit more of 10s (timeout should be 15s) triggering session destruction without a clear reason so there is definitely more digging to do.

Could you share the entire logs? Also, if possible, attaching a video of the issue occuring would be ideal.