OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src=media-file.js></script> |
| 5 <script src=video-test.js></script> |
| 6 <script> |
| 7 var audio, sourceA, sourceB; |
| 8 |
| 9 function canplaythrough(e) |
| 10 { |
| 11 testExpected("audio.currentSrc == sourceA.src", true); |
| 12 endTest(); |
| 13 } |
| 14 |
| 15 function loadedMetadataA() |
| 16 { |
| 17 consoleWrite("loadedMetadataA"); |
| 18 audio.removeChild(sourceA); |
| 19 audio.appendChild(sourceB); |
| 20 waitForEventAndFail("loadedmetadata"); |
| 21 } |
| 22 |
| 23 function onWindowLoad(e) |
| 24 { |
| 25 audio = document.getElementById('a'); |
| 26 waitForEvent("loadstart"); |
| 27 waitForEvent("progress"); |
| 28 waitForEvent("emptied"); |
| 29 waitForEvent("suspend"); |
| 30 waitForEvent("loadeddata"); |
| 31 waitForEvent("canplay"); |
| 32 waitForEventOnce('canplaythrough', canplaythrough); |
| 33 |
| 34 sourceA = document.createElement("source"); |
| 35 var audioFile = findMediaFile("audio", "content/test"); |
| 36 sourceA.setAttribute("src", audioFile); |
| 37 sourceB = document.createElement("source"); |
| 38 audioFile = findMediaFile("audio", "content/silence"); |
| 39 sourceB.setAttribute("src", audioFile); |
| 40 |
| 41 waitForEventOnce("loadedmetadata", loadedMetadataA); |
| 42 audio.appendChild(sourceA); |
| 43 } |
| 44 |
| 45 window.addEventListener('load', onWindowLoad, false); |
| 46 </script> |
| 47 </head> |
| 48 <body> |
| 49 <audio id="a"></audio> |
| 50 </body> |
| 51 </html> |
OLD | NEW |