I run my webrtc code with chrome 21.
If I open two tabs in the same chrome, and then open page with webrtc code inside. One tab is for sending video stream; one tab is f
While testing WebRTC, I found that such condition occurs when we call peerConnection.addStream(…)
in the wrong place ----
You must remember that ordering highly matters in WebRTC!
Blank video occurs in following cases:
OfferToReceiveVideo:true
HTMLMediaElement.HAVE_CURRENT_DATA
or mediaElement.paused
or mediaElement.currentTime
whilst it is android which has known issues regarding these properties.OfferToReceiveAudio
/OfferToReceiveVideo
are used according to stream(s) attached.Ordering of the code is, kind of rare-issues, nowadays, because we all know that addStream
should be called before creating offer or answer; even for renegotiated sessions.
Try to use chrome://webrtc-internals
and Firefox's about:config
to see what's happening inside these browsers; and always use console-logs for onIceConnectionStateChange
event which helps you check if ICE-Agent failed
in the ICE-connectivity check process or...
Sometimes setting-remote-sdp for offerer too earlier, causes exceptions. Always use onSdpError
both for createOffer
/createAnswer
and setLocalDescription
/setRemoteDescription
e.g.
peer.setRemoteDescription(remoteSDP, onSdpSuccess, onSdpFailure);
A few demos resources:
and https://www.webrtc-experiment.com/docs/TURN-server-installation-guide.html
I had the same issue, and I just resolved it by calling VideoElement.play() right after attaching the stream as the VideoElement.src
document.querySelector( "#video" ).src = window.URL.createObjectURL( remoteStream );
document.querySelector( "#video" ).play();
Don't wait for the loadedmetadata event because it doesn't seem to be triggered but the WebRTC stream.