W3C home > Mailing lists > Public > public-html-media@w3.org > June 2012

Re: [MSE] Moving Media Source methods into a separate object.

From: Mark Watson <watsonm@netflix.com>
Date: Fri, 15 Jun 2012 00:59:40 +0000
To: Aaron Colwell <acolwell@google.com>
CC: "<public-html-media@w3.org>" <public-html-media@w3.org>
Message-ID: <A9FA3746-042F-44FB-9080-8C732E8CE989@netflix.com>
Hi Aaron,

I think this is a good idea. It exposes the underlying source buffer model more clearly in the structure of the interface. It's preferable to work with a real object with functionality instead of an id where you could get confused about what kind of id it is and what it functionality it has.

ůMark



On Jun 14, 2012, at 1:17 PM, Aaron Colwell wrote:

Bug 17082<https://www.w3.org/Bugs/Public/show_bug.cgi?id=17082> was created because several people suggested that the Media Source Extensions should be more object oriented instead of just adding methods to HTMLMediaElement. There was some initial discussion about this in the bug comments, but I haven't gotten any more feedback after I proposed an initial design. I'm hoping some discussion on this list will help move this along since solutions to other bugs may depend on what we decide here.

Here is what I've proposed in the bug.

interface SourceBuffer : EventTarget {
 // Returns the time ranges buffered.
 readonly attribute TimeRanges buffered;

 // Append segment data.
 void append(DOMString url,
             optional unsigned long long start,
             optional unsigned long long length);

 // Abort the current segment append sequence.
 void abort();

 enum EndOfStreamError { "network", "decode" };
 void endOfStream(optional EndOfStreamError error);

 [TreatNonCallableAsNull] attribute Function? onappenddone;
 [TreatNonCallableAsNull] attribute Function? onappenderror;
};

interface SourceBufferList : EventTarget {
 readonly attribute unsigned long length;
 getter SourceBuffer (unsigned long index);
 void remove(SourceBuffer buffer);

 [TreatNonCallableAsNull] attribute Function? onaddsourcebuffer;
 [TreatNonCallableAsNull] attribute Function? onremovesourcebuffer;
};

[Constructor (DOMString type)]
interface MediaSource : EventTarget {
 readonly attribute SourceBufferList buffers;

 // Adds another source buffer.
 SourceBuffer addSourceBuffer(DOMString type);

 enum State { "closed", "open", "ended" };
 readonly attribute State readyState;

 [TreatNonCallableAsNull] attribute Function? onsourceclosed;
 [TreatNonCallableAsNull] attribute Function? onsourceopen;
 [TreatNonCallableAsNull] attribute Function? onsourceended;
};

I've included the url based append signature from Bug 16998<https://www.w3.org/Bugs/Public/show_bug.cgi?id=16998> and string enums suggested in Bug 16938<https://www.w3.org/Bugs/Public/show_bug.cgi?id=16938>. If people want, I can change this back to the current append signature & enum values so the initial spec edits will be a simple transfomation of the current text.

The type passed to the MediaSource constructor is the type for the initial SourceBuffer. I did this because a MediaSource object with no SourceBuffers isn't really useful.

Associating the MediaSource with a <video> would be similar to LocalMediaStream.
1. Create a MediaSource object.
2. Use createObjectURL() to get a blob URL for the MediaSource object.
3. Assign the blob URL to HTMLMediaElement.src.

Please let me know what you think.

Thanks,
Aaron
Received on Friday, 15 June 2012 01:00:35 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:32:55 UTC