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

sample: Add manual joinstoragesession button & reduce retry delay #261

Closed sirknightj closed 10 months ago

sirknightj commented 11 months ago

What was changed?

  1. [WebRTC Ingestion] Add a button that lets users manually call JoinStorageSession on the Webpage (to reduce the need to use the AWS CLI). Mainly used for testing purposes. Add a checkbox that decides whether or not that button should be shown (not shown by default).
  2. [WebRTC Ingestion] When a peer connection fails to be established with the media ingestion peer, we will initiate a retry faster.
  3. Add option to pass in correlationId into the Signaling messages (and add unit tests for that).
  4. Receive STATUS_RESPONSE messages in case any are received. We will emit a statusResponse event containing this STATUS_RESPONSE object.
  5. [WebRTC ingestion] In this mode, remove the remote-view:
image
  1. [WebRTC ingestion] In this mode, disable data channel use, overriding the value of the checkbox, if needed.

  2. The color of the Stop button was changed to red. This makes it easier to quickly identify. This has been changed for both Master and Viewer.

image

How was it changed?

  1. This button is not shown by default. To show it, you need to enable the newly-added checkbox:

    image

After this box is checked, the button will appear next to "Stop Master" after successfully connecting to Signaling.

image

2.

Previously what happens is that we listen for the PeerConnection state transitioning to failed, and that triggers the retry. From my testing, it takes Google WebRTC around 15 seconds to transition to the FAILED state which is a bit slow.

We change the original retry initiation from:

To:

  1. In the sample, I added correlationId to the SDP_ANSWER for master.
  2. In WebRTC ingestion mode, when we receive an error statusResponse, we will exit the sample application.

Testing

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.