Skip to content

vtt.js VTTCue cannot be added to TextTrack #385

@robwalch

Description

@robwalch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions