1
/*****************************************************************************************
2
* Testing basic support for the MSE SourceBuffer JavaScript object
3
*****************************************************************************************/
5
alert("Script loaded");
7
function enumerate(e, s)
9
for(var propertyName in e) {
10
alert((s==null?"":s)+" "+propertyName+": "+e[propertyName]);
11
if (typeof(e[propertyName]) == "object") {
12
enumerate(e[propertyName], " ");
17
function onSourceOpen(event)
19
alert("MediaSource opened");
20
/* GPAC Hack: since the event is not targeted to the MediaSource, we need to get the MediaSource back */
21
var ms = event.target.ms;
24
alert("Checking if type video/mp4 is supported: "+MediaSource.isTypeSupported("video/mp4"));
25
alert("Checking if type video/ogg is supported: "+MediaSource.isTypeSupported("video/ogg"));
26
alert("Checking if type text/plain is supported: "+MediaSource.isTypeSupported("text/plain"));
27
alert("Checking if type application/octet-stream is supported: "+MediaSource.isTypeSupported("application/octet-stream"));
29
alert("Adding Source Buffer of type video/mp4 to the MediaSource");
30
var sb = ms.addSourceBuffer("video/mp4");
31
alert("SourceBuffer "+sb);
33
enumerate(sb.buffered);
38
var v = document.getElementById("v");
40
alert("Creating new MediaSource");
41
var ms = new MediaSource();
43
/* GPAC Hack: the event should be dispatched to the MediaSource object */
44
v.addEventListener("sourceopen", onSourceOpen);
46
var url = URL.createObjectURL(ms);
47
alert("Attaching Media Source "+url+" to Video");
50
/* GPAC hack to retrieve the MediaSource from the video when the sourceopen event is dispatched */
b'\\ No newline at end of file'