diff options
Diffstat (limited to 'dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html')
-rw-r--r-- | dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html b/dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html new file mode 100644 index 000000000..f932b3d4e --- /dev/null +++ b/dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html @@ -0,0 +1,56 @@ +<!DOCTYPE html> +<html><head> +<meta http-equiv="content-type" content="text/html; charset=windows-1252"> + <title>MSE: |waiting| event when source data is missing</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="mediasource.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<pre id="test"><script class="testbody" type="text/javascript"> + +SimpleTest.waitForExplicitFinish(); + +runWithMSE(function(ms, el) { + el.controls = true; + once(ms, 'sourceopen').then(function() { + ok(true, "Receive a sourceopen event"); + var audiosb = ms.addSourceBuffer("audio/mp4"); + var videosb = ms.addSourceBuffer("video/mp4"); + // ensure tracks end at approximately the same time to ensure ended event is + // always fired (bug 1233639). + audiosb.appendWindowEnd = 3.9; + videosb.appendWindowEnd = 3.9; + fetchAndLoad(audiosb, 'bipbop/bipbop_audio', ['init'], '.mp4') + .then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', ['init'], '.mp4')) + .then(fetchAndLoad.bind(null, audiosb, 'bipbop/bipbop_audio', range(1, 5), '.m4s')) + .then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', range(1, 6), '.m4s')) + .then(function() { + // HTMLMediaElement fires 'waiting' if somebody invokes |play()| before the MDSM + // has notified it of available data. Make sure that we get 'playing' before + // we starting waiting for 'waiting'. + info("Invoking play()"); + var p = once(el, 'playing'); + el.play(); + return p; + }).then(function() { + ok(true, "Video playing. It should play for a bit, then fire 'waiting'"); + var p = once(el, 'waiting'); + el.play(); + return p; + }).then(function() { + var p = once(el, 'ended'); + ms.endOfStream(); + return p; + }).then(function() { + is(el.duration, 3.854512, "Video has correct duration: " + el.duration); + is(el.currentTime, el.duration, "Video has correct currentTime."); + SimpleTest.finish(); + }); + }); +}); + +</script> +</pre> +</body> +</html> |