mirror of
https://github.com/videojs/video.js.git
synced 2025-01-02 06:32:07 +02:00
parent
f27df30ca5
commit
9f2d81fb9b
936
package-lock.json
generated
936
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -95,7 +95,7 @@
|
||||
"mux.js": "6.0.1",
|
||||
"safe-json-parse": "4.0.0",
|
||||
"videojs-font": "3.2.0",
|
||||
"videojs-vtt.js": "^0.15.4"
|
||||
"videojs-vtt.js": "^0.15.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.0",
|
||||
|
@ -395,7 +395,7 @@ class TextTrack extends Track {
|
||||
addCue(originalCue) {
|
||||
let cue = originalCue;
|
||||
|
||||
if (window.vttjs && !(originalCue instanceof window.vttjs.VTTCue)) {
|
||||
if (cue.constructor && cue.constructor.name !== 'VTTCue') {
|
||||
cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);
|
||||
|
||||
for (const prop in originalCue) {
|
||||
|
@ -231,6 +231,21 @@ QUnit.test('original cue can be used to remove cue from cues list', function(ass
|
||||
assert.equal(tt.cues.length, 0, 'we have removed cue1');
|
||||
});
|
||||
|
||||
QUnit.test('non-VTTCue can be used to remove cue from cues list', function(assert) {
|
||||
const tt = new TextTrack({
|
||||
tech: this.tech
|
||||
});
|
||||
|
||||
const cue1 = { id: 1, text: 'test' };
|
||||
|
||||
assert.equal(tt.cues.length, 0, 'start with zero cues');
|
||||
tt.addCue(cue1);
|
||||
assert.equal(tt.cues.length, 1, 'we have one cue');
|
||||
|
||||
tt.removeCue(cue1);
|
||||
assert.equal(tt.cues.length, 0, 'we have removed cue1');
|
||||
});
|
||||
|
||||
QUnit.test('can only remove one cue at a time', function(assert) {
|
||||
const tt = new TextTrack({
|
||||
tech: this.tech
|
||||
|
Loading…
Reference in New Issue
Block a user