mirror of
https://github.com/videojs/video.js.git
synced 2024-12-25 02:42:10 +02:00
This commit is contained in:
parent
91aa06fe56
commit
bb50466733
@ -4,6 +4,7 @@ CHANGELOG
|
|||||||
## HEAD (Unreleased)
|
## HEAD (Unreleased)
|
||||||
* Added cross-browser isArray for cross-frame support. fixes #1195 ([view](https://github.com/videojs/video.js/pull/1218))
|
* Added cross-browser isArray for cross-frame support. fixes #1195 ([view](https://github.com/videojs/video.js/pull/1218))
|
||||||
* Fixed support for webvtt chapters. Fixes #676. ([view](https://github.com/videojs/video.js/pull/1221))
|
* Fixed support for webvtt chapters. Fixes #676. ([view](https://github.com/videojs/video.js/pull/1221))
|
||||||
|
* Fixed issues around webvtt cue time parsing. Fixed #877, fixed #183. ([view](https://github.com/videojs/video.js/pull/1236))
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
@ -482,9 +482,9 @@ vjs.TextTrack.prototype.parseCues = function(srcContent) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Timing line
|
// Timing line
|
||||||
time = line.split(' --> ');
|
time = line.split(/[\t ]+/);
|
||||||
cue.startTime = this.parseCueTime(time[0]);
|
cue.startTime = this.parseCueTime(time[0]);
|
||||||
cue.endTime = this.parseCueTime(time[1]);
|
cue.endTime = this.parseCueTime(time[2]);
|
||||||
|
|
||||||
// Additional lines - Cue Text
|
// Additional lines - Cue Text
|
||||||
text = [];
|
text = [];
|
||||||
|
@ -21,10 +21,6 @@ test('cue time parsing', function() {
|
|||||||
equal(parse('11:11'), 671, 'Only minutes and seconds (11:11)');
|
equal(parse('11:11'), 671, 'Only minutes and seconds (11:11)');
|
||||||
equal(parse('11:11:11'), 40271, 'Hours, minutes, seconds (11:11:11)');
|
equal(parse('11:11:11'), 40271, 'Hours, minutes, seconds (11:11:11)');
|
||||||
equal(parse('11:11:11.111'), 40271.111, 'Hours, minutes, seconds, decimals (11:11:11.111)');
|
equal(parse('11:11:11.111'), 40271.111, 'Hours, minutes, seconds, decimals (11:11:11.111)');
|
||||||
|
|
||||||
// Uncommment to test a fix for #877
|
|
||||||
// equal(parse('11:11 line:90%'), 671, 'minutes, seconds with flags');
|
|
||||||
// equal(parse('11:11:11 line:90%'), 40271, 'hours, minutes, seconds with flags');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('cue parsing', function() {
|
test('cue parsing', function() {
|
||||||
@ -43,10 +39,15 @@ test('cue parsing', function() {
|
|||||||
equal(mockTrack.cues_[0].endTime, 4.11, 'Cue end time w/ spaces');
|
equal(mockTrack.cues_[0].endTime, 4.11, 'Cue end time w/ spaces');
|
||||||
equal(mockTrack.cues_[0].text, 'Text line 1', 'Cue text');
|
equal(mockTrack.cues_[0].text, 'Text line 1', 'Cue text');
|
||||||
|
|
||||||
// Uncomment to test a fix for #183
|
mockTrack.reset(); // reset mock track
|
||||||
// mockTrack.reset(); // reset mock track
|
var timeWithTabs = vttHead + '00:00.700\t-->\t00:04.110\nText line 1';
|
||||||
// var timeWithTabs = vttHead + '00:00.700\t-->\t00:04.110\nText line 1';
|
mockTrack.parseCues(timeWithTabs);
|
||||||
// mockTrack.parseCues(timeWithTabs);
|
equal(mockTrack.cues_[0].startTime, 0.7, 'Cue start time w/ spaces');
|
||||||
// equal(mockTrack.cues_[0].startTime, 0.7, 'Cue start time w/ spaces');
|
equal(mockTrack.cues_[0].endTime, 4.11, 'Cue end time w/ spaces');
|
||||||
// equal(mockTrack.cues_[0].endTime, 4.11, 'Cue end time w/ spaces');
|
|
||||||
|
mockTrack.reset(); // reset mock track
|
||||||
|
var timeWithMixedWhiteSpace = vttHead + '00:00.700 -->\t 00:04.110\nText line 1';
|
||||||
|
mockTrack.parseCues(timeWithMixedWhiteSpace);
|
||||||
|
equal(mockTrack.cues_[0].startTime, 0.7, 'Cue start time w/ spaces');
|
||||||
|
equal(mockTrack.cues_[0].endTime, 4.11, 'Cue end time w/ spaces');
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user