~ubuntu-branches/debian/experimental/gpac/experimental

« back to all changes in this revision

Viewing changes to regression_tests/html5_video/basic_sourcebuffer.js

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2014-02-22 18:15:00 UTC
  • mfrom: (1.2.2) (3.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20140222181500-b4phupo05gjpmopa
Tags: 0.5.0+svn5104~dfsg1-1
* New  upstream version 0.5.0+svn5104~dfsg1:
  - src/utils/sha1.c is relicensed under LGPLv2.1, Closes: #730759
* Don't install modules in multi-arch directories, Closes: #730497
* Add libusb-1.0.0-dev headers because libfreenect requires this
* Fix install rule
* Follow upstream soname bump
  - Drop the symbols file for now until it has been revised thourougly
* Let binaries produce the correct svn revision
* Refresh patches
* Patch and build against libav10, Closes: #739321
* Bump standards version, no changes necessary

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************************
 
2
 * Testing basic support for the MSE SourceBuffer JavaScript object
 
3
 *****************************************************************************************/
 
4
 
 
5
alert("Script loaded");
 
6
 
 
7
function enumerate(e, s)
 
8
{
 
9
        for(var propertyName in e) {
 
10
                alert((s==null?"":s)+" "+propertyName+": "+e[propertyName]);
 
11
                if (typeof(e[propertyName]) == "object") {
 
12
                        enumerate(e[propertyName], " ");
 
13
                }
 
14
        }               
 
15
}
 
16
 
 
17
function onSourceOpen(event)
 
18
{
 
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;
 
22
        enumerate(ms);
 
23
        
 
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"));
 
28
 
 
29
        alert("Adding Source Buffer of type video/mp4 to the MediaSource");
 
30
        var sb = ms.addSourceBuffer("video/mp4");
 
31
        alert("SourceBuffer "+sb);
 
32
        enumerate(sb);
 
33
        enumerate(sb.buffered);
 
34
}
 
35
 
 
36
function init()
 
37
{       
 
38
        var v = document.getElementById("v");
 
39
        
 
40
        alert("Creating new MediaSource");
 
41
        var ms = new MediaSource();                     
 
42
 
 
43
        /* GPAC Hack: the event should be dispatched to the MediaSource object */
 
44
        v.addEventListener("sourceopen", onSourceOpen);
 
45
                                
 
46
        var url = URL.createObjectURL(ms);
 
47
        alert("Attaching Media Source "+url+" to Video");
 
48
        v.src = url;
 
49
        
 
50
        /* GPAC hack to retrieve the MediaSource from the video when the sourceopen event is dispatched */
 
51
        v.ms = ms;
 
52
        
 
53
}
 
 
b'\\ No newline at end of file'