Last active
February 23, 2017 03:02
-
-
Save BenjaminSchaaf/0b32042c609d5d5d7c837d2247e391ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<title>WebVTT parser test: timings, omitted hours</title> | |
<link rel="help" href="https://w3c.github.io/webvtt/#file-parsing"> | |
<script src="/resources/testharness.js"></script> | |
<script src="/resources/testharnessreport.js"></script> | |
<div id=log></div> | |
<script> | |
var t = async_test('timings, omitted hours'); | |
t.step(function(){ | |
var video = document.createElement('video'); | |
var track = document.createElement('track'); | |
assert_true('src' in track, 'track element not supported'); | |
track.src = 'support/omitted-hours.vtt'; | |
track['default'] = true; | |
track.kind = 'subtitles'; | |
track.onload = this.step_func(trackLoaded); | |
track.onerror = this.step_func(trackError); | |
video.appendChild(track); | |
document.body.appendChild(video); | |
}); | |
function trackLoaded(event) { | |
var track = event.target; | |
var video = track.parentNode; | |
var cues = video.textTracks[0].cues; | |
{ | |
assert_equals(cues.length, 3); | |
Array.from(cues).forEach(function(cue) { | |
assert_equals(cue.startTime, 0); | |
assert_equals(cue.endTime, 1); | |
}); | |
} | |
this.done(); | |
} | |
function trackError(e) { | |
assert_unreached('got unexpected error event: ' + JSON.stringify(e)); | |
this.done(); | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timings, omitted hours | |
<link rel="help" href="https://w3c.github.io/webvtt/#file-parsing"> | |
assert_equals(cues.length, 3); | |
Array.from(cues).forEach(function(cue) { | |
assert_equals(cue.startTime, 0); | |
assert_equals(cue.endTime, 1); | |
}); | |
=== | |
WEBVTT | |
00:00.000 --> 00:00:01.000 | |
text1 | |
00:00:00.000 --> 00:01.000 | |
text2 | |
00:00.000 --> 00:01.000 | |
text3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WEBVTT | |
00:00.000 --> 00:00:01.000 | |
text1 | |
00:00:00.000 --> 00:01.000 | |
text2 | |
00:00.000 --> 00:01.000 | |
text3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment