Video.js: Subtitles not working after uglifying the code by Angular CLI

Created on 30 Apr 2018  路  9Comments  路  Source: videojs/video.js

We are using the video.js Player in combination with an angular-cli project. By the addRemoteTextTrack method of the player, I add subtitles to the video.

this.vjsPlayer.addRemoteTextTrack({
    kind: '/path/to/file.vtt',
    label: 'Test',
    src
}, true);

This works great when I麓m in the development mode of the project. But when I uglify the code by angular-cli by the command ng build --prod, the subtitles will not update anymore. What I mean is, that it stays on the subtitle text when you have activated the subtitles but the text does not get updated.

Most of the time I use Chrome for development but this happens in every browser.

Versions

  • "video.js: "6.8.0"
  • "videojs-contrib-dash": "2.9.3"
  • "videojs-contrib-hls": "5.14.1"
  • "@angular/cli": "1.7.4"
  • "@angular/core": "5.2.10"

Most helpful comment

Yeah! Thanks @gkatsev, it's really a pleasure to have a module with a great support, that releases a fixed version just a few hours later. :kissing_heart:

All 9 comments

Looking at the cli, not really sure what's wrong. Would you be able to make a simple page with Video.js and upload it somewhere?

If we get a reduced test case, we'll be able to take a look.

@gkatsev We have the same bug. It's because of this.activeCues https://github.com/videojs/video.js/blob/4d3331e3be17198d9e0eefab29d06134928de5d8/src/js/tracks/text-track.js#L181 that is removed by uglify.

@Chocobozzz interesting, do you know which rule removes that?

@gkatsev Yes, it's the pure_getters rule https://github.com/mishoo/UglifyJS2/#compress-options

Unfortunately we cannot change this rule in angular-cli...

An easy fix would be to change the line to this.activeCues = this.activeCues since the activeCues setter has no effect.

@Chocobozzz seems like that should work, would you be interested in making a PR for that?

Thanks @Chocobozzz! I plan on doing a release of Video.js today, so, it should go out then.

Yeah! Thanks @gkatsev, it's really a pleasure to have a module with a great support, that releases a fixed version just a few hours later. :kissing_heart:

Applying this fix this.activeCues = this.activeCues in an older version (5.8.0) also addresses this bug. Thank you @Chocobozzz

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dingyaguang117 picture dingyaguang117  路  4Comments

aagiulian picture aagiulian  路  3Comments

d3x7r0 picture d3x7r0  路  4Comments

TheKassaK picture TheKassaK  路  3Comments

jeonghwaYoo picture jeonghwaYoo  路  3Comments