| <!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 finishTest() |
| { |
| consoleWrite("<br>** Track should not be visible. **"); |
| testExpected("video.textTracks[0].mode", "disabled"); |
| |
| consoleWrite(""); |
| endTest(); |
| } |
| |
| function seeked() |
| { |
| consoleWrite("<br>** Track should be visible, cue should be styled appropriately. **"); |
| testExpected("video.textTracks[0].mode", "showing"); |
| testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(0, 0, 255)"); |
| testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(255, 255, 0)"); |
| |
| consoleWrite("<br>** Remove the video from the document, add it back. **"); |
| run("video.parentNode.removeChild(video)"); |
| run("document.body.appendChild(video)"); |
| |
| consoleWrite("<br>** Change caption display mode to generate a notification. **"); |
| run("setCaptionDisplayMode('ForcedOnly')"); |
| |
| // The notification is sent asynchronously, so check after a brief pause. |
| timer = setTimeout(finishTest, 100); |
| } |
| |
| function canplaythrough() |
| { |
| consoleWrite(""); |
| run("video.currentTime = .5"); |
| consoleWrite(""); |
| } |
| |
| function loaded() |
| { |
| consoleWrite(""); |
| run("internals.setCaptionDisplayMode('AlwaysOn')"); |
| run("internals.setCaptionsStyleSheetOverride('video::cue { color: blue; background-color: yellow; }')"); |
| run("internals.settings.setShouldDisplayTrackKind('Captions', true)"); |
| |
| findMediaElement(); |
| video.src = findMediaFile('video', '../content/test'); |
| waitForEvent('seeked', seeked); |
| waitForEvent('canplaythrough', canplaythrough); |
| consoleWrite(""); |
| } |
| |
| </script> |
| </head> |
| <body onload="loaded()"> |
| <span>Test that caption preferences change notifications work</span> |
| <video controls > |
| <track src="captions-webvtt/styling.vtt" kind="captions"> |
| </video> |
| </body> |
| </html> |