[Bug 26060] New: Media Source and Web Worker

https://www.w3.org/Bugs/Public/show_bug.cgi?id=26060

            Bug ID: 26060
           Summary: Media Source and Web Worker
           Product: HTML WG
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Media Source Extensions
          Assignee: adrianba@microsoft.com
          Reporter: saran@exaeone.com
        QA Contact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-media@w3.org

One possible use case scenario for the Media Source Extension is to construct a
live video stream. In an effort to keep latency low, one may decide to make the
media segments very small but have them arrive very frequently. This has the
potential to cause the main thread to block and become unresponsive.

In order to alleviate this, it would be useful to be able to create the
MediaSource object in a Worker running in a separate thread, and send its Blob
URI back to the parent script.

As an example, with still images it is currently possible to do the following
with XMLHttpRequest. The same technique may also be useful in the MediaSource
scenario using WebSockets (which are already available in Workers).

----------
main.js
----------
var worker = new Worker('worker.js');
var img;

window.onload = function (event) {
    img = document.getElementById('img');
    worker.postMessage('bh.jpg');
}

worker.onmessage = function (event) {
    img.src = event.data;
}
----------

----------
worker.js
----------
var xhr = new XMLHttpRequest();
var ms = new MediaSource();

onmessage = function (event) {
    xhr.open('GET', event.data, true);
    xhr.responseType = 'blob';
    xhr.send();
}

xhr.onload = function (event) {
    postMessage(URL.createObjectURL(xhr.response));
}
----------

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 11 June 2014 14:14:52 UTC