MediaStream Constructor

Hi all,

We discussed earlier today about the possibility of combining multiple 
MediaStreams into a single stream via it's constructor; in the context 
of allowing multiple calls to getUserMedia to obtain a stream for each 
camera. Even if we don't end up allowing that, it might be useful in 
other contexts.

Robert O'Callahan has suggested that we extend the MediaStream 
constructor to take a list of Objects, which can be a combination of 
MediaStreams or MediaStreamTracks.

[Constructor MediaStream(obj1, obj2, obj3, ..., objN)];

This behavior is much in line with functions like Array.concat [1], and 
highlights the flexibility JS programmers are accustomed to, since we 
are not restricted with type safety as much as other languages.

I haven't mentioned MediaStreamTrackLists though, because I think they 
are a redundant type that may simply be represented as an array of 
MediaStreamTracks. If there are good reasons to keep the 
MediaStreamTrackList around, please do let me know. Otherwise, we can 
modify the MediaStream object to be:

interface MediaStream {
     readonly attribute DOMString            label;
     readonly attribute MediaStreamTrack[] audioTracks;
     readonly attribute MediaStreamTrack[] videoTracks;
              attribute boolean              ended;
              attribute Function?            onended;
};

and move the "onaddtrack" and "onremovetrack" events from the 
MediaStreamTrackList object up to MediaStream itself.

I support these two changes proposed above. Feedback appreciated!

Regards,
-Anant

Received on Thursday, 10 May 2012 03:21:05 UTC