awslabs / amazon-kinesis-video-streams-webrtc-sdk-android

Android SDK for interfacing with Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
58 stars 37 forks source link

LTE to WIFI connection not working #75

Closed Emefar closed 1 year ago

Emefar commented 2 years ago

I started live stream with WIFI and i turned off my WIFI and opened LTE. Live stream was frozen. When i turn on WIFI again, everything is good.

nickhuangcyh commented 2 years ago

Hi @Emefar ,

I think this is normal condition, WebRTC is base on STUN, TURN and ICE tech You can read this article to understand the principle STUN TURN ICE Principle

You can't use the same p2p tunnel, because the private/public IP and NAT are changed after you change network interface from WIFI to LTE

So you need to create a new connection (p2p) after network interface is changed

If you can understand Chinese, you can refer to my blog post P2P tech

I hope you find this information helpful!

Emefar commented 2 years ago

@nickhuang9527 Kinesis is generating STUN, TURN and ICE Servers for connection. I think this is a not normal condition. WebRTC apps can change the network state at any time with using TURN.

https://github.com/stasel/WebRTC-iOS/issues/18

sirknightj commented 1 year ago

When a network change occurs, you would need to renegotiate the connection.

See https://stackoverflow.com/questions/68233305/how-to-ice-restart-in-android-peerconnection-client

If the signaling WebSocket is closed, you would also need to re-connect to that so that master can exchange offer/answer/icecandidates with the viewer.