Skip to content

Commit

Permalink
fix: subtitles/captions freeze when using uglify (#5346)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Chocobozzz authored and gkatsev committed Jul 26, 2018
1 parent 98e3c81 commit 226188d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/js/tracks/text-track.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,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;
Expand Down Expand Up @@ -323,6 +322,8 @@ class TextTrack extends Track {

return activeCues;
},

// /!\ Keep this setter empty (see the timeupdate handler above)
set() {}
});

Expand Down

0 comments on commit 226188d

Please sign in to comment.