| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Enabling a track with legacy API succeeds when in "Automatic" mode</title> |
| |
| <script src=../media-file.js></script> |
| <script src=../video-test.js></script> |
| <script src=../trackmenu-test.js></script> |
| <script src=../media-controls.js></script> |
| <script> |
| |
| function seeked() |
| { |
| consoleWrite("<br><i>** Check to make sure captions are displaying<" + "/i>"); |
| |
| testExpected("video.textTracks[0].cues", null, '!='); |
| testExpected("textTrackDisplayElement(video, 'cue').textContent", null, '!='); |
| |
| consoleWrite(""); |
| endTest(); |
| } |
| |
| function trackLoaded() |
| { |
| consoleWrite("EVENT(load)"); |
| track = event.target; |
| testExpected("track.readyState", HTMLTrackElement.LOADED); |
| run("video.currentTime = 0.5"); |
| waitForEvent('seeked', seeked); |
| consoleWrite(""); |
| } |
| |
| function canplaythrough() |
| { |
| consoleWrite("<br><i>** Test initial state<" + "/i>"); |
| testExpected("video.textTracks.length", 1); |
| testExpected("video.textTracks[0].mode", "disabled"); |
| |
| consoleWrite("<br><i>** Enable cues, allow them to load<" + "/i>"); |
| run("video.webkitClosedCaptionsVisible = true"); |
| } |
| |
| function setup() |
| { |
| consoleWrite("<br><i>** Setup<" + "/i>"); |
| findMediaElement(); |
| |
| if (window.internals) |
| run("internals.setCaptionDisplayMode('Automatic')"); |
| run("trackElement = document.createElement('track')"); |
| run("trackElement.kind = 'captions'"); |
| run("trackElement.src = 'captions-webvtt/tc004-webvtt-file.vtt'"); |
| run("video.appendChild(trackElement)"); |
| |
| video.src = findMediaFile('video', '../content/test'); |
| trackElement.setAttribute('onload', 'trackLoaded()'); |
| waitForEvent('canplaythrough', canplaythrough); |
| consoleWrite(""); |
| } |
| |
| </script> |
| </head> |
| <body onload="setup()"> |
| <video controls width=500></video> |
| <p>Test that enabling a track with .webkitClosedCaptionsVisible succeeds when in "automatic" mode.</p> |
| </body> |
| </html> |