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

JS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.
https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-js/examples/index.html
Apache License 2.0
286 stars 141 forks source link

Viewer does not resend SDP offer if master receives SDP offer but fails to send answer #175

Closed fblundun closed 2 years ago

fblundun commented 2 years ago

In my code, the "viewer" side of the WebRTC call uses the KVSWebRTC.SignalingClient.sendSdpOffer function to send an SDP offer, and the "master" side of the call listens for "sdpOffer" events and reacts to them by calling KVSWebRTC.SignalingClient.sendSdpAnswer.

This usually all works fine. But I've found that the following sequence of events can happen:

Am I correct in thinking that the SDP offer is "consumed" when the master side signalling client first fires the "sdpOffer" event?

What's the appropriate way to handle this? Is the viewer side supposed to speculatively make fresh SDP offers every few seconds, in case the above sequence of events has occurred? Is there any way for the viewer side to know that their SDP offer has been lost?

(I also asked this on StackOverflow: https://stackoverflow.com/questions/72690321/how-do-i-rescue-my-webrtc-connection-when-my-sdp-offer-is-swallowed)

disa6302 commented 2 years ago

@fblundun ,

You are correct. The master connection needs to be opened first so that the offer sent by the viewer can be consumed. If you refresh the master page, the viewer needs to resend the offer. This kind of handshake mechanism will have to be incorporated outside of the realm of WebRTC. You can have some kind of=handshake message between master and viewer to allow this.