[email protected] | 0c6f8e4 | 2009-07-30 16:05:02 | [diff] [blame] | 1 | <html> |
2 | <head> | ||||
[email protected] | b61b47d | 2011-02-24 23:10:46 | [diff] [blame] | 3 | <script src=media-file.js></script> |
4 | <script src=video-test.js></script> | ||||
[email protected] | 0c6f8e4 | 2009-07-30 16:05:02 | [diff] [blame] | 5 | |
6 | <script> | ||||
7 | |||||
[email protected] | 02a554d8 | 2009-08-20 17:21:35 | [diff] [blame] | 8 | function playing() |
[email protected] | 0c6f8e4 | 2009-07-30 16:05:02 | [diff] [blame] | 9 | { |
[email protected] | 02a554d8 | 2009-08-20 17:21:35 | [diff] [blame] | 10 | consoleWrite("EVENT(playing)<br>"); |
11 | endTest(); | ||||
12 | } | ||||
13 | |||||
[email protected] | 7bdbeb8 | 2009-10-19 17:13:08 | [diff] [blame] | 14 | function canplaythrough() |
[email protected] | 02a554d8 | 2009-08-20 17:21:35 | [diff] [blame] | 15 | { |
[email protected] | 7bdbeb8 | 2009-10-19 17:13:08 | [diff] [blame] | 16 | consoleWrite("EVENT(canplaythrough)"); |
[email protected] | 0c6f8e4 | 2009-07-30 16:05:02 | [diff] [blame] | 17 | consoleWrite(""); |
[email protected] | 1b9d340 | 2009-08-06 21:09:24 | [diff] [blame] | 18 | run("document.getElementById('parent').appendChild(mediaElement)"); |
19 | run("mediaElement.play()"); | ||||
[email protected] | 0c6f8e4 | 2009-07-30 16:05:02 | [diff] [blame] | 20 | consoleWrite(""); |
21 | } | ||||
22 | |||||
23 | function start() | ||||
24 | { | ||||
[email protected] | 1b9d340 | 2009-08-06 21:09:24 | [diff] [blame] | 25 | run("mediaElement = document.createElement('audio')"); |
[email protected] | 0c6f8e4 | 2009-07-30 16:05:02 | [diff] [blame] | 26 | |
[email protected] | 7bdbeb8 | 2009-10-19 17:13:08 | [diff] [blame] | 27 | mediaElement.setAttribute('oncanplaythrough', "canplaythrough()"); |
[email protected] | 02a554d8 | 2009-08-20 17:21:35 | [diff] [blame] | 28 | mediaElement.setAttribute('onplaying', "playing()"); |
[email protected] | 0c6f8e4 | 2009-07-30 16:05:02 | [diff] [blame] | 29 | |
30 | waitForEvent("loadstart"); | ||||
31 | waitForEvent("waiting"); | ||||
32 | waitForEvent("ratechange"); | ||||
33 | waitForEvent("durationchange"); | ||||
34 | waitForEvent("pause"); | ||||
35 | waitForEvent("play"); | ||||
[email protected] | 4ce8195 | 2009-10-26 15:27:57 | [diff] [blame] | 36 | waitForEvent("canplaythrough"); |
[email protected] | 0c6f8e4 | 2009-07-30 16:05:02 | [diff] [blame] | 37 | waitForEvent('loadeddata'); |
38 | |||||
[email protected] | e12b7ef | 2009-09-24 01:20:43 | [diff] [blame] | 39 | var mediaFile = findMediaFile("audio", "content/test"); |
40 | run("mediaElement.src = '" + mediaFile + "'"); | ||||
[email protected] | 1b9d340 | 2009-08-06 21:09:24 | [diff] [blame] | 41 | run("mediaElement.load()"); |
[email protected] | 0c6f8e4 | 2009-07-30 16:05:02 | [diff] [blame] | 42 | |
43 | consoleWrite(""); | ||||
44 | } | ||||
45 | |||||
46 | </script> | ||||
47 | </head> | ||||
48 | |||||
49 | <body onload="start()"> | ||||
50 | |||||
51 | <p>Test that media file is not reloaded when an element is inserted into the DOM.</p> | ||||
52 | |||||
53 | <div id="parent"></div> | ||||
54 | |||||
55 | </body> | ||||
56 | </html> |