let constraints = {
audio: this.voice_flag,
video: {
mandatory: {
maxWidth: 320,
maxFrameRate: 15,
minFrameRate: 15
}
}
};
if (this.videoSelect.length > 1) {
this.currVideoIndex = this.currVideoIndex == 0 ? 1 : 0;
constraints.video.optional = [
{
sourceId: this.videoSelect[this.currVideoIndex]
}
];
}
navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
let localVideo =
this.participants[this.orgnPersonId].getVideoElement();
let localStream = localVideo.srcObject;
let tracks = localStream.getTracks();
tracks.forEach((track) => {
track.stop();
});
localVideo.srcObject = stream;
this.webRtcPeer.peerConnection
.getSenders()[1]
.replaceTrack(stream.getVideoTracks()[0]);
});
网友评论