您可以同时将音频和视频的mediaConstraints(音频和视频)都设置为false来订阅WebRTC流吗?当一个人订阅了一个流都设置为false的流,然后又试图取消对所订阅用户的静音时,则会出现音频流未定义的错误。从某种意义上来说,如果音频和视频都没有订阅,那么什么都将被订阅。但是WebRTC / Kurento专家的验证将有所帮助。
let participant = participants[senderid];
var options = {
remoteVideo: videoElement,
mediaConstraints: {audio:false,video:false},
participantid: senderid,
onicecandidate:participant.onIceCandidate.bind(participant)
};
participant.rtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(options, function (error) {
if (error) {
return console.error(error);
}
this.generateOffer(participant.offerToReceiveVideo.bind(participant));
});
this.socket.on('userStatusChanged',(senderid)=>{
let participant = participants[senderid];
// Here I want to enable the audio for this sender.
})
// Note: - I tried the below case. But getting undefined in remoteStream. // let remoteStream = participant.rtcPeer.peerConnection.getRemoteStreams()[0];