[whatwg] File API Streaming Blobs

On 8/9/2011 9:38 AM, Aaron Colwell wrote:
> FYI I'm working on an experimental extension to Chromium to allow 
> media data to be streamed into a media element via JavaScript. Here is 
> the draft spec 
> <http://html5-mediasource-api.googlecode.com/svn/tags/0.2/draft-spec/mediasource-draft-spec.html> and 
> pending WebKit patch 
> <https://bugs.webkit.org/show_bug.cgi?id=64731> related to this work. 
> I have simple WebM VOD playback w/ seeking working where all media 
> data is fetched via XHR.

It's nice to see this patch.

I'm hoping to see streamed array buffers in XHR, though fetching in 
chunks can work,
given the relatively small overhead of HTTP headers vs Video content.

The WHAWG specs have a Media Stream example which uses URL createObjectURL:
navigator.getUserMedia('video user', gotStream, noStream);
function gotStream(stream) {
     video.src = URL.createObjectURL(stream);
http://www.whatwg.org/specs/web-apps/current-work/complete/video-conferencing-and-peer-to-peer-communication.html#dom-mediastream

The WHATWG spec seems closer to (mediaElement.createStream()).append() 
semantics.
Both WHATWG and the draft spec agree on src=uri;

File API has to toURL semantics on objects, simlar to the draft spec, 
for getting filesystem:// uris.

My understanding: The draft spec is simpler, intended only to be used by 
HTMLMediaElement
and only by one element at a time, without introducing a new object. In 
the long
run, it may make sense to create a media stream object, consistent with 
the WHATWG direction.

On another note, Mozilla Labs has some experiments on recording video 
from <canvas> (as well as general webcam, etc):
https://mozillalabs.com/rainbow/
https://github.com/mozilla/rainbow
https://github.com/mozilla/rainbow/blob/master/content/example_canvas.html


-Charles

Received on Wednesday, 10 August 2011 14:05:37 UTC