sampotts / plyr

A simple HTML5, YouTube and Vimeo player
https://plyr.io
MIT License
26.38k stars 2.92k forks source link

Duplicate captions when using HLS #2520

Open kiritokatklian opened 2 years ago

kiritokatklian commented 2 years ago

Expected behaviour

One instance of captions is shown on the video.

Actual behaviour

Two sets of captions are shown on the video.

Steps to reproduce

  1. Enable caption (click the CC button)
  2. Play the video
  3. Go to 1:45 minutes
  4. Change caption to Español

At this point you should see duplicate captions. If not:

  1. Refresh page (Español is now auto selected)
  2. Go to 1:45 minutes

Extra:

  1. Disable captions (only one caption disables; possibly related)

Environment

Console errors (if any)

No errors.

Link to where the bug is happening

HLS + duplicate captions: https://codepen.io/Shawl8938/pen/zYWQMOZ

Additional Notes

Tested with FireFox Nightly 106, but this happened on 105 too. It also happens in normal FireFox. I've been struggling with this for days 😅

This happens with any caption selected, not just Español as in the steps above.

Disabling captions through Plyr only disables one of the captions. My guess is that HLS.js is the culprit of the second set of captions (it's on the video directly).

Issue couldn't be replicated on Safari.

Example

Screen Shot 2022-08-26 at 13 23 08
kiritokatklian commented 2 years ago

I did a bit more digging, and as I suspected it has to do with HLS.

Issue happens with latest version of HLS 1.2.1. This example from #994 doesn't have the same issue, because it uses an older version of HLS 0.9.1

Placing the latest HLS version in the above example which didn't have any issues with captions, causes the duplicate caption issue.

My guess is something changed between those two versions and Plyr hasn't been updated to handle this change.

Update

I tried using HLS 0.10.0 which came right after 0.9.1, and the same issue occurred. There are 183 commits between the two, so not sure how to pinpoint the change 😅

benbois commented 1 year ago

Similar problem with kind="subtitles" and no subtitles with kind="captions" with HLS version 1.0.0 > 1.2.4. Subtitles show with HLS version 0.9.1 and kind="captions".

benbois commented 1 year ago

For record, this problem came back with plyr v3.7.7 and hls v1.3.5 !

mudit2108 commented 5 months ago

Faced the same issue, I am using HLS.js 1.5.7 and plyr 3.7 Resolved it by turning off the subtitles explicitly in HLS.js

// Assuming you have a reference to your HLS.js player instance var player = new Hls(); player.loadSource('path/to/your/video.m3u8'); player.attachMedia(videoElement);

// Disable captions player.subtitleDisplay = false;

zain-mansuri commented 5 months ago

Faced the same issue, I am using HLS.js 1.5.7 and plyr 3.7 Resolved it by turning off the subtitles explicitly in HLS.js

// Assuming you have a reference to your HLS.js player instance var player = new Hls(); player.loadSource('path/to/your/video.m3u8'); player.attachMedia(videoElement);

// Disable captions player.subtitleDisplay = false;

Worked for me, Thanks