blob: 0eca0e1903e47eb4973865e7dd793de84481f163 [file] [log] [blame]
Tests that a track appended after the initial track configuration does not change other tracks.
RUN(internals.setCaptionDisplayMode('Automatic'))
EVENT(load) -- <body>
EXPECTED (track1.readyState == '0') OK
EXPECTED (track1.track.mode == 'disabled') OK
EVENT(canplaythrough) -- <video>
**check initial metadata track state
EXPECTED (track1.readyState == '0') OK
EXPECTED (track1.track.mode == 'disabled') OK
EXPECTED (track1.track.cues == 'null') OK
RUN(track1.track.mode = 'hidden')
EVENT(load) -- <track kind='metadata' >
**check metadata track state
EXPECTED (track1.readyState == '2') OK
EXPECTED (track1.track.mode == 'hidden') OK
EXPECTED (track1.track.cues.length == '12') OK
EXPECTED (track1.track.cues[11].startTime == '22') OK
**add a caption track, configured to load automatically
RUN(track2 = document.createElement('track'))
RUN(track2.setAttribute('kind', 'captions'))
RUN(track2.setAttribute('default', 'default'))
RUN(track2.setAttribute('onload', 'captionsTrackLoaded()'))
RUN(track2.setAttribute('src', 'captions-webvtt/tc004-webvtt-file.vtt'))
RUN(video.appendChild(track2))
EVENT(load) -- <track kind='captions' >
**check that metadata track state has not changed
EXPECTED (track1.readyState == '2') OK
EXPECTED (track1.track.mode == 'hidden') OK
**and that the caption track state is correct
EXPECTED (track2.readyState == '2') OK
EXPECTED (track2.track.mode == 'showing') OK
**add a subtitle track with video.addTextTrack()
RUN(track3 = video.addTextTrack('subtitles', 'Subtitle Track', 'en'))
RUN(track3.mode = 'showing')
EVENT(addtrack)
**check that metadata track state has not changed
EXPECTED (track1.readyState == '2') OK
EXPECTED (track1.track.mode == 'hidden') OK
**and that the caption track state has not changed
EXPECTED (track2.readyState == '2') OK
EXPECTED (track2.track.mode == 'showing') OK
**and that the subtitle track state is correct
EXPECTED (event.target == '[object TextTrackList]') OK
EXPECTED (event instanceof window.TrackEvent == 'true') OK
EXPECTED (event.track == '[object TextTrack]') OK
EXPECTED (track3.mode == 'showing') OK
END OF TEST