4 <script src=
"/media-resources/video-test.js"></script>
7 <video autoplay
controls=
"controls" id='vid'
></video>
8 <p>Tests that sourceopen event fires even if garbage collection happens between setting video.src
& the sourceopen event.
</p>
9 <script type=
"text/javascript">
10 var sourceOpened
= false;
12 function createMediaSourceURL()
14 var mediaSource
= new MediaSource();
15 var onSourceOpen = function (e
)
18 consoleWrite("onSourceOpen called.");
21 consoleWrite("Setting sourceopen event listener.");
22 mediaSource
.addEventListener('sourceopen', onSourceOpen
);
23 return window
.URL
.createObjectURL(mediaSource
);
28 var video
= document
.getElementById('vid');
29 var onStalled = function (e
)
34 failTest('stalled event fired before sourceopen');
36 video
.addEventListener('stalled', onStalled
);
38 var url
= createMediaSourceURL();
39 consoleWrite("Running garbage collector.");
42 consoleWrite("Setting video.src to object URL.");