peterhpchen
4/24/2014 - 3:26 AM

control remote peer's video and audio

control remote peer's video and audio

remoteStream = new webkitMediaStream(localStream);

//Add local stream to connection
peerLocalConnection.addStream(remoteStream);
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;
    }
}
<input type="checkbox" id="disabledVideo"/>Disabled remote video
<input type="checkbox" id="disabledAudio"/>Disabled remote audio