Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtitles not working after uglifying the code by Angular CLI #5131

Closed
qstiegler opened this issue Apr 30, 2018 · 9 comments · Fixed by #5346 · May be fixed by CleverTap/vue-video-player#3
Closed

Subtitles not working after uglifying the code by Angular CLI #5131

qstiegler opened this issue Apr 30, 2018 · 9 comments · Fixed by #5346 · May be fixed by CleverTap/vue-video-player#3

Comments

@qstiegler
Copy link

qstiegler commented Apr 30, 2018

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"
@qstiegler qstiegler changed the title Subtitles not working after uglifying the code Subtitles not working after uglifying the code by Angular CLI Apr 30, 2018
@gkatsev
Copy link
Member

gkatsev commented Apr 30, 2018

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?

@gkatsev
Copy link
Member

gkatsev commented Jun 18, 2018

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

@gkatsev gkatsev closed this as completed Jun 18, 2018
@Chocobozzz
Copy link
Contributor

@gkatsev We have the same bug. It's because of this.activeCues

this.activeCues;
that is removed by uglify.

@gkatsev
Copy link
Member

gkatsev commented Jul 26, 2018

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

@Chocobozzz
Copy link
Contributor

@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.

@gkatsev gkatsev reopened this Jul 26, 2018
@gkatsev
Copy link
Member

gkatsev commented Jul 26, 2018

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

gkatsev pushed a commit that referenced this issue Jul 26, 2018
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
@gkatsev
Copy link
Member

gkatsev commented Jul 26, 2018

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

gkatsev pushed a commit that referenced this issue Jul 26, 2018
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
@Chocobozzz
Copy link
Contributor

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. 😘

@thenewbeat
Copy link

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants