|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test that capturing a stream doesn't stop the underlying element from firing events</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
7 <script type="text/javascript" src="manifest.js"></script> |
|
8 </head> |
|
9 <body> |
|
10 <audio id="a"></audio> |
|
11 <pre id="test"> |
|
12 <script class="testbody" type="text/javascript"> |
|
13 SimpleTest.waitForExplicitFinish(); |
|
14 |
|
15 var a = document.getElementById('a'); |
|
16 var validTimeUpdate = false; |
|
17 |
|
18 function startTest() { |
|
19 a.src = "big.wav"; |
|
20 var context = new AudioContext(); |
|
21 var node = context.createMediaElementSource(a); |
|
22 node.connect(context.destination); |
|
23 a.addEventListener("timeupdate", function() { |
|
24 if (a.currentTime > 0.0 && a.currentTime < 5.0 && !validTimeUpdate) { |
|
25 validTimeUpdate = true; |
|
26 ok(true, "Received reasonable currentTime in a timeupdate"); |
|
27 SimpleTest.finish(); |
|
28 } |
|
29 }); |
|
30 a.addEventListener("ended", function() { |
|
31 if (!validTimeUpdate) { |
|
32 ok(false, "Received reasonable currentTime in a timeupdate"); |
|
33 SimpleTest.finish(); |
|
34 } |
|
35 }); |
|
36 a.play(); |
|
37 } |
|
38 |
|
39 if (a.canPlayType("audio/wave")) { |
|
40 startTest(); |
|
41 } else { |
|
42 todo(false, "No playable audio"); |
|
43 } |
|
44 </script> |
|
45 </pre> |
|
46 </body> |
|
47 </html> |