Skip to content

Commit

Permalink
misc: add HIDDEN and SHOWING to ICompatTextTrack
Browse files Browse the repository at this point in the history
  • Loading branch information
peaBerberian committed Jun 2, 2020
1 parent 9207e21 commit d70fae4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/compat/add_text_track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export default function addTextTrack(

if (isIEOrEdge) {
const tracksLength = mediaElement.textTracks.length;
track = tracksLength > 0 ? mediaElement.textTracks[tracksLength - 1] :
mediaElement.addTextTrack(kind);
track.mode = hidden ? ((track as any).HIDDEN ?? "hidden") :
((track as any).SHOWING ?? "showing");
track = (tracksLength > 0 ? mediaElement.textTracks[tracksLength - 1] :
mediaElement.addTextTrack(kind)) as ICompatTextTrack;
track.mode = hidden ? (track.HIDDEN ?? "hidden") :
(track.SHOWING ?? "showing");
} else {
trackElement = document.createElement("track");
mediaElement.appendChild(trackElement);
Expand Down
2 changes: 2 additions & 0 deletions src/compat/browser_compatibility_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ interface ICompatVTTCue { align : string;
interface ICompatTextTrack extends TextTrack {
addCue(cue: TextTrackCue | ICompatVTTCue) : void;
removeCue(cue: TextTrackCue | ICompatVTTCue) : void;
HIDDEN? : "hidden";
SHOWING? : "showing";
}

/**
Expand Down

0 comments on commit d70fae4

Please sign in to comment.