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

vtt.js VTTCue cannot be added to TextTrack #385

Open
robwalch opened this issue Oct 16, 2019 · 2 comments
Open

vtt.js VTTCue cannot be added to TextTrack #385

robwalch opened this issue Oct 16, 2019 · 2 comments

Comments

@robwalch
Copy link

Replacing window.VTTCue results in an exception being throws when attempting to create and append a cue to an HTMLMediaElement TextTrack.

Web video players like Hls.js and JW Player parse and add metadata cues to TextTracks using window.VTTCue. When vtt.js has been added to the page, window.VTTCue is replaced. Attempting to add a cue to a TextTrack which is an instance of this project's VTTCue results in an uncaught type error:

textTrack.addCue(vttCue);
> Uncaught TypeError: Failed to execute 'addCue' on 'TextTrack': parameter 1 is not of type 'TextTrackCue'.

window.VTTCue is the constructor which we need to use to create a valid TextTrackCue (new TextTrackCue cannot be constructed in Chrome).

I would prefer that this library either not replace native APIs (polyfill), or extend them (shim) such that they not produce errors like this one. Replacing the the native API completely means we can only catch this exception, loose functionality and then point the finger to this library one any one using it.

@robwalch
Copy link
Author

robwalch commented Oct 16, 2019

Example of a site affected by this: https://www.tasteofhome.com/recipes/hearty-potato-soup/

@IsaacMartin22
Copy link

I'm also running into this issue because vtt.js is a dependency being used. Same exact error message, the cue's type is VTTCue when it should be TextTrackCue. Can someone from Mozilla comment on this? Is this issue going to be addressed?

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

No branches or pull requests

2 participants