peerjs icon indicating copy to clipboard operation
peerjs copied to clipboard

on("stream") event should receive a unique MediaStream from a peer

Open baptisteArno opened this issue 5 years ago • 2 comments

on("stream") event currently receives 2 MediaStream objects from a unique peer. Both of these streams contain the audio and video tracks. We should only receive the MediaStream once.

Capture d’écran 2020-03-29 à 22 07 19

baptisteArno avatar Mar 29 '20 20:03 baptisteArno

You do have the MediaStream object sent once. The MediaStream however contains two tracks of type MediaStreamTrack. An audio and a video track

TbreezyF avatar Apr 10 '20 00:04 TbreezyF

Because we fire on('stream') when peerConnection.ontrack called, so it called twice per one MediaStream with two tracks.

https://github.com/peers/peerjs/blob/master/lib/negotiator.ts#L145-L154

afrokick avatar Apr 20 '20 14:04 afrokick