Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/media-elements/track/track-element/no-cuechange-before-play.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Ensure that the 'cuechange' event is not fired before video playback has begun.</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(function(t) {
let video = document.createElement('video');
video.src = getVideoURI('/media/movie_5');
video.preload = 'auto';
// Create a track element. The 'cuechange' event should not be fired.
let track = document.createElement('track');
track.oncuechange = t.unreached_func('The \`cuechange\` event should not be fired');
let videoWatcher = new EventWatcher(t, video, 'canplaythrough');
let trackWatcher = new EventWatcher(t, track, ['cuechange', 'load'])
track.src = 'resources/captions-fast.vtt';
track.kind = 'captions';
track.default = true;
track.track.mode = 'showing';
video.appendChild(track);
return Promise.all([videoWatcher.wait_for('canplaythrough'), trackWatcher.wait_for('load')]);
});
</script>