[Bug 12530] <video> Make TrackList an Array-like list of Track objects and move get* into those

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12530

Ian 'Hixie' Hickson <ian@hixie.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roc@ocallahan.org
             Blocks|                            |12412, 12983
           Severity|critical                    |normal

--- Comment #7 from Ian 'Hixie' Hickson <ian@hixie.ch> 2011-06-22 00:22:08 UTC ---
Please don't change the severity field of bugs assigned to me. (Changing the
severity is not going to make me look at things quicker — if you want me to
look at things more quickly, please ping me on IRC or e-mail me. I use the
severity field to categorise input for planning purposes.)

As it happens, I was just looking at this because I need to do something like
this for bug 12412 and bug 12983. The problem with doing this is that it makes
it hard to reuse the same API for MediaStream, because if we have a MediaStream
constructor, we wouldn't want it to get the same VideoTrack and AudioTrack
objects as HTMLMediaElements expose in their videoTracks and audioTracks lists,
since that would make no sense (the latter aren't streaming tracks, they're
buffered tracks, even if the input is actually a MediaStream).

I don't really want to duplicate all the interfaces here, and having a
hierarchy like:

   AbstractTrack -> AbstractVideoTrack -> BufferedVideoTrack
               \                      `-> StreamingVideoTrack
                `-> AbstractAudioTrack -> BufferedAudioTrack
                                      `-> StreamingAudioTrack

...seems like overengineering, especially since we'd still need the Streaming*
cases to implement another interface so they could be listed all together in
the MediaStream constructor...

Maybe the MediaStream constructor should just take Streams, and it merges the
enabled tracks of those streams, rather than taking Tracks? But then there's no
good way to take a MediaStream with three video tracks and create from it a
MediaStream with three video tracks and one audio track, or some such.

Going back to use cases, maybe we don't need to merge streams. We just need a
way to enable and disable streams, and maybe twiddle the volumes on audio
tracks.

So maybe the way to go is:

   AbstractTrack -> VideoTrack
                `-> AudioTrack

...and a MediaStream constructor that lets you chain from a previous
MediaStream, so that if you want to mute a track on an outgoing MediaStream,
you just create a new MediaStream from the GeneratedMediaStream, and that's the
one you twiddle and pass on to PeerConnection, so the connections would look
like:

                          1                 2                      :
   GeneratedMediaStream ----> MediaStream ----> PeerConnection ----:---> (peer)
     |                                                             :
    \|/                                                            :
   <video>                                                         :

...where 1 is "new MediaStream(generatedStream)", and 2 is addStream(stream).

Then, to disable outgoing video without affecting the local mirror, you just
take the MediaStream object between you get form 1, and call something like: 

   stream.videoTracks[0].pause();

   stream.videoTracks[0].resume(); // later

...on it.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 22 June 2011 00:22:10 UTC