Skip to content

Instantly share code, notes, and snippets.

@peterhpchen
Last active August 29, 2015 14:00
Show Gist options
  • Save peterhpchen/11240463 to your computer and use it in GitHub Desktop.
Save peterhpchen/11240463 to your computer and use it in GitHub Desktop.
control remote peer's video and audio
<input type="checkbox" id="disabledVideo"/>Disabled remote video
<input type="checkbox" id="disabledAudio"/>Disabled remote audio
function disabledVideo() {
//video
if (disabledVideoBox.checked) {
trace("Disabled video");
remoteStream.getVideoTracks()[0].enabled = false;
}
else if (!disabledVideoBox.checked) {
trace("Enabled video");
remoteStream.getVideoTracks()[0].enabled = true;
}
}
function disabledAudio() {
//audio
if (disabledAudioBox.checked) {
trace("Disabled audio");
remoteStream.getAudioTracks()[0].enabled = false;
}
else if (!disabledAudioBox.checked) {
trace("Enabled audio");
remoteStream.getAudioTracks()[0].enabled = true;
}
}
remoteStream = new webkitMediaStream(localStream);
//Add local stream to connection
peerLocalConnection.addStream(remoteStream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment