Why the muted video tag cannot be unmuted?
Dear All
I am building a Web application using WebRTC technology.
The problem is that I cannot unmute the muted media which has the muted attribute.
This is my video tag that receive the remote media stream:
<video id="remoteView" width="320" height="240" autoplay controls muted></video>
The following coding for add local media stream to the remote RTCPeerConnection object.
setupStream=((stream)=>{ if (pc){ var senders=pc.getSenders(); if (senders.length<1) { stream.getTracks().forEach((track)=>{ logger("0 add "+track.kind+" track"); pc.addTrack(track,stream); }); } else { senders.forEach((sender)=>{ if (sender.track) sender.track.stop(); }); stream.getTracks().forEach((track)=>{ var sender = pc.getSenders().find(function(s) { if (s.track) return s.track.kind == track.kind; else return null; }); if (sender==null) { logger("1 add "+track.kind+" track"); pc.addTrack(track,stream); } else { logger("0 replace "+track.kind+" track"); sender.replaceTrack(track); } }); } }
The following code handle ontrack event:
remoteVideo=document.getElementById("remoteView"); if (remoteVideo.srcObject==null){ remoteView.srcObject=event.streams[0]; } else { remoteVideo.srcObject.addTrack(event.track); }
The problem is that when I add 1 audio track to remote RTCPeerConnection object first, and then add 1 video track to remote RTCPeerConnection object, the remote side default control panel unmute button working properly.
However, if I add 1 video track to remote RTCPeerConnection object first, and then add 1 audio track to remote RTCPeerConnection object, the remote side default control panel unmute button does not work. I need to right-click the media player and then select "unmute" to play remote audio.
I am using FireFox version 77.0.1 Chinese edition. I am using windows 10 OS.
Would you tell me what is going on?
Izmjenjeno