blob: eb072c4c0a81d5b043dd1a5b4753b818d060fb03 [file] [log] [blame]
Test that we update the menu when the selected track changes.
EVENT(canplaythrough)
*** Set the user's preferred language to English, enable automatic caption selection.
RUN(internals.setUserPreferredLanguages(['en']))
RUN(internals.setCaptionDisplayMode('AlwaysOn'))
** The preferred language is set to English, but the Spanish track should be enabled because it is available
Track menu:
0: "Off"
1: "Auto (Recommended)"
2: "Spanish", checked
EXPECTED (video.textTracks[0].mode == 'showing') OK
*** Add a text track in the preferred language.
RUN(track = document.createElement('track'))
RUN(track.setAttribute('kind', 'captions'))
RUN(track.src = 'data:text/vtt,WEBVTT%0A%0A00%3A00%3A00.000%20--%3E%2000%3A00%3A01.000%0ACaption%201%0A')
RUN(track.setAttribute('srclang', 'en'))
RUN(track.setAttribute('onload', 'trackLoaded()'))
RUN(video.appendChild(track))
EVENT(load)
*** The new track should be selected because it is in the preferred language.
EXPECTED (event.target.srclang == 'en') OK
EXPECTED (event.target.readyState == '2') OK
EXPECTED (video.textTracks[0].mode == 'disabled') OK
EXPECTED (video.textTracks[1].mode == 'showing') OK
Track menu:
0: "Off"
1: "Auto (Recommended)"
2: "English", checked
3: "Spanish"
END OF TEST