-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer-text-tracks.ts
More file actions
32 lines (29 loc) · 1.1 KB
/
player-text-tracks.ts
File metadata and controls
32 lines (29 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { TextTrackKind } from '../consts/text-tracks';
import type { IPlayerTextTrack } from '../types/text-track.declarations';
export class PlayerTextTrack implements IPlayerTextTrack {
public readonly id: string;
public readonly activeCues: TextTrackCueList | null;
public readonly cues: TextTrackCueList | null;
public readonly kind: TextTrackKind;
public readonly label: string;
public readonly language: string;
public readonly mode: string;
public constructor(textTrack: TextTrack) {
this.id = textTrack.id;
this.activeCues = textTrack.activeCues;
this.cues = textTrack.cues;
this.kind = textTrack.kind as TextTrackKind;
this.label = textTrack.label;
this.language = textTrack.language;
this.mode = textTrack.mode;
}
public static fromTextTracks(textTrackList: TextTrackList): Array<PlayerTextTrack> {
const playerTextTracks = [];
for (let i = 0; i < textTrackList.length; i++) {
if (textTrackList[i].kind !== TextTrackKind.Metadata) {
playerTextTracks.push(new PlayerTextTrack(textTrackList[i]));
}
}
return playerTextTracks;
}
}