Skip to content

Instantly share code, notes, and snippets.

@digitallysavvy
Last active July 19, 2019 21:47
Show Gist options
  • Save digitallysavvy/9667474ed38eef463b41785dbbe45c66 to your computer and use it in GitHub Desktop.
Save digitallysavvy/9667474ed38eef463b41785dbbe45c66 to your computer and use it in GitHub Desktop.
remote stream toggles
// show mute icon whenever a remote has muted their mic
client.on("mute-audio", function (evt) {
toggleVisibility('#' + evt.uid + '_mute', true);
});
client.on("unmute-audio", function (evt) {
toggleVisibility('#' + evt.uid + '_mute', false);
});
// show user icon whenever a remote has disabled their video
client.on("mute-video", function (evt) {
var remoteId = evt.uid;
// if the main user stops their video select a random user from the list
if (remoteId != mainStreamId) {
// if not the main vidiel then show the user icon
toggleVisibility('#' + remoteId + '_no-video', true);
}
});
client.on("unmute-video", function (evt) {
toggleVisibility('#' + evt.uid + '_no-video', false);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment