aws / amazon-chime-sdk-js

A JavaScript client library for integrating multi-party communications powered by the Amazon Chime service.
Apache License 2.0
716 stars 472 forks source link

Implementing a connection indicator / status for a realtime video meeting #2924

Closed kuentinozaure closed 2 months ago

kuentinozaure commented 4 months ago

What are you trying to do?

Hello everyone 👋,

I have an app similar to Zoom or Google Meet, where users can start their camera and microphone through the browser.

I need to implement a connection status indicator to let users know when their connection quality decreases.

However, users can join the meeting without enabling their camera and microphone, which causes issues. I tried using connectionDidBecomeGood, connectionDidBecomePoor, and connectionDidSuggestStopVideo, but these events aren't triggered unless the user is in a meeting with audio and/or video enabled.

I've also tried using metricsDidReceive to get metrics like currentRoundTripTimeMs and availableOutgoingBitrate, but it seems I need to have the microphone or video on to get accurate or updated values.

I attempted to use realtimeSubscribeToLocalSignalStrengthChange, but it also seems to require the video or microphone to be on to get the updated data.

How can the documentation be improved to help your use case?

What documentation have you looked at so far?

hensmi-amazon commented 3 months ago

The values in metricsDidReceive should still work even if audio is muted. I would look at currentRoundTripTimeMs, and audio packet loss. I would not use availableOutgoingBitrate as it isn't meant to be a measurement of link bandwidth and may not be the value you expect.

nathan-wright-streem commented 3 months ago

Based on observation, it seems like audio roundTripTime updates when audio is muted, but video roundTripTime does not update when the camera is off. Is that correct?

hensmi-amazon commented 3 months ago

That sounds correct to me. The STUN RTT (which is used for currentRoundTripTimeMs) should also be always available. Its determined by STUN pings on the same path as media. All these values should be the same.

ltrung commented 2 months ago

https://github.com/aws/amazon-chime-sdk-js/blob/main/README.md usecase 10 also has an example on how to check audio signal from signal strength using realtimeSubscribeToVolumeIndicator.