Re: What happened to onaddstream?

On 23/06/15 13:07, Silvia Pfeiffer wrote:

>
> I did some more digging.
>
> Reading the spec, I stumble over both an ontrack and an onaddtrack
> event. The ontrack event is used in Example 4 to replace the
> onaddstream event from earlier on the RTCPeerConnection. The
> onaddtrack fires on MediaStream directly.
> So, we're really talking about the ontrack event here.

Right.

>
> It seems to me that ontrack has the exact same definition as
> onaddstream, except it is a RTCTrackEvent (and not a MediaStreamEvent)
> and can report the addition of multiple MediaStream objects in one go.
>
> http://w3c.github.io/webrtc-pc/#idl-def-RTCTrackEvent
> I'm actually a bit confused about this description: it seems that a
> track can be part of multiple streams there. That's not how I
> understand MediaStreams to work - rather, a track would always be part
> of one stream, but a stream could have multiple tracks.

I think both ways are OK. A MediaStream is basically a collection of 
MediaStreamTrack's, but a MediaStreamTrack can be part of more than one 
MediaStream.

Just assume you have MediaStream's A and B, and a MediastreamTrack X, 
AFAIK nothing forbids

A.addTrack(X);
B.addTrack(X);

Cheers,
Stefan


Received on Wednesday, 24 June 2015 07:10:08 UTC