According to RTCPeerConnection.ontrack documentation, "ontrack" event suppose to fire for each incoming streams. I have a PeerConnection with two video streams, after connection, "ontrack" fires two times (up to here everything is OK). But both times it sends same stream out, so I end up with two identical video, I am sure sender is sending two different streams, dimension and frame rate of them are different and I can clearly see in chrome://webrtc-internals/ that 2 video streams have different frame size/rate.
Here is PeerConnection ontrack code:
this.peerConnection.ontrack = function(evt) {
console.log("PeerConnection OnTrack event: ", evt.streams);
that.emit('onRemoteStreamAdded', evt.streams);
};
I don't assume evt.streams
has 1 object, so I did not write evt.streams[0]
.
As it is obvious from log getRemoteStreams()
returns only one object. How is it possible ontrack
fires two time when it has only one stream, and why second RTCRtpTransceiver does not make a new stream?
pc.addTrack()
it will be automatically created for you on receiving part. Look – Sewage