| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| |
| <script src=../media-file.js></script> |
| <script src=../video-test.js></script> |
| <script src=../media-controls.js></script> |
| |
| <script> |
| |
| function testCues() |
| { |
| cueDisplayElement = null; |
| cueNode = null; |
| try { |
| cueDisplayElement = textTrackDisplayElement(video, 'display', 0); |
| cueNode = textTrackDisplayElement(video, 'cue'); |
| } catch (ex) { |
| consoleWrite('<br>Text track cue at time 0.3s not visible. Track cues are:'); |
| for (var i = 0; i < inbandTrack1.cues.length; i++) |
| consoleWrite(" cue " + i + ": start time = " + inbandTrack1.cues[i].startTime.toFixed(2) + ", text = " + inbandTrack1.cues[i].text); |
| failTest("<br>"); |
| return; |
| } |
| |
| consoleWrite("<br><i>** Test current cue colors<" + "/i>"); |
| testExpected("cueNode.style.color", "rgb(255, 255, 255)"); |
| testExpected("cueNode.style.backgroundColor", "rgb(0, 0, 0)"); |
| |
| endTest(); |
| } |
| |
| function tracksChanged() |
| { |
| run("video.play()"); |
| setTimeout(function() { |
| video.pause(); |
| video.currentTime = 0.3; |
| waitForEventOn(inbandTrack1, 'cuechange', testCues); |
| }, 1000); |
| } |
| |
| function canplaythrough() |
| { |
| consoleWrite("<br><i>** Check initial in-band track states<" + "/i>"); |
| waitForEventOn(video.textTracks, 'change', tracksChanged); |
| run("inbandTrack1 = video.textTracks[0]"); |
| testExpected("video.textTracks.length", 1); |
| testExpected("inbandTrack1.language", "en"); |
| testExpected("inbandTrack1.kind", "captions"); |
| run("inbandTrack1.mode = 'showing'"); |
| } |
| |
| function loaded() |
| { |
| consoleWrite("Test that style to all cues is applied correctly."); |
| findMediaElement(); |
| video.src = '../content/counting-captioned.mov'; |
| waitForEvent('canplaythrough', canplaythrough); |
| } |
| |
| </script> |
| </head> |
| <body onload="loaded()"> |
| <video controls > |
| </video> |
| </body> |
| </html> |