vtt.js VTTCue cannot be added to TextTrack
robwalch opened this issue · comments
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.
Example of a site affected by this: https://www.tasteofhome.com/recipes/hearty-potato-soup/
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?