1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-28 08:58:46 +02:00

fix: subtitles/captions freeze when using uglify (#5346)

Angular CLI, and potentially other projects, may use the "pure_getters" compression option of uglify which will end up removing the getter line we use for side-effects to update the active cues. This update makes sure that the line doesn't get removed.

Fixes #5131
This commit is contained in:
Chocobozzz 2018-07-26 20:16:03 +02:00 committed by Gary Katsevman
parent 8c92cbfb3e
commit 5e21ebbd2b

View File

@ -177,9 +177,8 @@ class TextTrack extends Track {
// Accessing this.activeCues for the side-effects of updating itself
// due to it's nature as a getter function. Do not remove or cues will
// stop updating!
/* eslint-disable no-unused-expressions */
this.activeCues;
/* eslint-enable no-unused-expressions */
// Use the setter to prevent deletion from uglify (pure_getters rule)
this.activeCues = this.activeCues;
if (changed) {
this.trigger('cuechange');
changed = false;
@ -313,6 +312,8 @@ class TextTrack extends Track {
return activeCues;
},
// /!\ Keep this setter empty (see the timeupdate handler above)
set() {}
}
});