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

WebVTT captions not rendering at all #982

Closed
eban5 opened this issue Oct 29, 2020 · 8 comments
Closed

WebVTT captions not rendering at all #982

eban5 opened this issue Oct 29, 2020 · 8 comments
Labels

Comments

@eban5
Copy link

eban5 commented Oct 29, 2020

Description

We are experiencing issues with not being able to render captions in our web player. Our HLS manifests reference a WebVTT file that the VideoJS player is able to download but I think something breaks during parsing. When we go to turn our captions on, an error shows up: Uncaught TypeError: Failed to construct 'VTTCue': The provided double value is non-finite. This leads us to find that in the player’s text tracks, startTime is showing up as NaN. This error appears to be getting thrown by the VTTSegmentLoader (handleSegment_ case):

segmentInfo.cues.forEach(function (cue) {
     _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new window$3.VTTCue(cue.startTime, cue.endTime, cue.text) : cue);
   });

Steps to reproduce

  1. Load the above example HLS stream as a source in a basic VideoJS player example or use the JSBin example posted above.
  2. Try to turn captions ON

Results

Expected

  • Turn captions ON and see captions rendered on screen

Error output

Uncaught TypeError: Failed to construct 'VTTCue': The provided double value is non-finite.

The stacktrace for this error points to VTTSegmentLoader's handleSegment_ switch case, particularly the following loop:

segmentInfo.cues.forEach(function (cue) {
     _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new window$3.VTTCue(cue.startTime, cue.endTime, cue.text) : cue);
   });

Additional Information

videojs-http-streaming version

videojs-http-streaming "1.13.2" and "2.2.3"

videojs version

video.js 7.8.4 and video.js 7.10.1

Browsers

  • Chrome / Firefox / Safari / Edge
  • Issue spotted on recent and latest versions of these browsers.

Platforms

  • Mac and PC (not tested with Linux)

Other Plugins

"videojs-contrib-ads": "6.7.0",
"videojs-contrib-quality-levels": "2.0.9",
"videojs-hls-quality-selector": "1.1.1",
"videojs-ima": "1.8.0",
"videojs-logo": "2.1.1",
"videojs-markers-plugin": "1.0.2",

Other JavaScript

  • Preact 10.5.3 / React 16.13
@welcome
Copy link

welcome bot commented Oct 29, 2020

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@eban5
Copy link
Author

eban5 commented Nov 9, 2020

Just wanted to stop by and see if there is any other information I can provide to make debugging this easier. I've been trying out the latest VideoJS 7.10.3 release, which includes http-streaming 2.3.0 but so far the issue persists. In the meantime, we're able to fallback to use sideloaded caption files. Thanks in advance.

@gkatsev
Copy link
Member

gkatsev commented Nov 17, 2020

Looks like for whatever reason the startTime and endTime come out as NaN which is why they aren't displaying.

@gkatsev
Copy link
Member

gkatsev commented Nov 18, 2020

I looked into it a bit and figured out the problem. It's because there's a space after the comma in the webvtt header. It's probably something we should fix but if you remove the space it'll start working again.
WORKING:

X-TIMESTAMP-MAP=MPEGTS:187507,LOCAL:00:00:00.000

BROKEN:

X-TIMESTAMP-MAP=MPEGTS:187507, LOCAL:00:00:00.000

@eban5
Copy link
Author

eban5 commented Nov 18, 2020

Thanks, @gkatsev ! I didn't think to check extra whitespaces. I'll give this a shot in the morning and update this ticket.

@gkatsev
Copy link
Member

gkatsev commented Nov 18, 2020

You're welcome. It's a tricky thing to find. I ended up stepping through the code and then noticed that it was searching for LOCAL instead of LOCAL.
It's definitely something we can handle better. At the very least we can check whether the cue times end up as NaN and log a warning or something.

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@eban5
Copy link
Author

eban5 commented Jul 14, 2022

@gkatsev, we happened to hit a blocker on our player that can be resolved by addressing this particular issue. I pushed a simple fix to trim the whitespace from the parsed keys over in videojs/vtt.js#60 and was hoping someone might be able to take a look. Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants