amazon-chime-sdk-component-library-react
amazon-chime-sdk-component-library-react copied to clipboard
Slow network Indication
I am trying to detect the slow network so I can notify the users in the meeting
please provide an indication for the slow network if already there then kindly provide me the link.
I have looked into this documentation 'https://aws.github.io/amazon-chime-sdk-component-library-react' and haven't found anything useful regarding my need.
Hi @UsmanShafaqat007 , SDK doesn't have an out-of-box network indicator at the moment.
SDK exposes the metrics from WebRTC stats via useMediaStreamMetrics
hook.
You can implement your own network indicator based on below two metrics exposed by useMediaStreamMetrics hook.
availableOutgoingBandwidth: number | null;
availableIncomingBandwidth: number | null;
Alternately, you can subscribe to the connectionDidBecomeGood
, connectionDidBecomePoor
, connectionDidSuggestStopVideo
, connectionHealthDidChange
events of AudioVideoObserver
to notify your user about the connection status change.
To access audioVideoObserver
in React Component Library, you can do it like this:
import { AudioVideoObserver } from 'amazon-chime-sdk-js';
const audioVideo = useAudioVideo();
useEffect(() => {
if (!audioVideo) {
return;
}
const observer: AudioVideoObserver = {
connectionDidBecomePoor(): void {
console.log('connection is poor');
},
connectionDidSuggestStopVideo(): void {
console.log('suggest turning the video off');
},
connectionDidBecomeGood(): void {
console.log('connection is good now');
}
};
audioVideo.addObserver(observer);
return () => audioVideo.removeObserver(observer);
}, [audioVideo]);
You might find this Quality, Bandwidth, and Connectivity Guide from Amazon Chime SDK for JavaScript helpful.
I will leave this issue open as a feature request. Thank you.