美文网首页
kurento切换摄像头

kurento切换摄像头

作者: 变异宝宝 | 来源:发表于2023-08-14 16:22 被阅读0次
                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]);
                });
    

    相关文章

      网友评论

          本文标题:kurento切换摄像头

          本文链接:https://www.haomeiwen.com/subject/garcmdtx.html