react-native-theoplayer
Version:
A THEOplayer video component for react-native.
152 lines (142 loc) • 4.82 kB
JavaScript
;
/**
* The content type of a text track, represented by a value from the following list:
* <br/> - `'srt'`: The track contains SRT (SubRip Text) content.
* <br/> - `'ttml'`: The track contains TTML (Timed Text Markup Language) content.
* <br/> - `'webvtt'`: The track contains WebVTT (Web Video Text Tracks) content.
* <br/> - `'emsg'`: The track contains emsg (Event Message) content.
* <br/> - `'eventstream'`: The track contains Event Stream content.
* <br/> - `'id3'`: The track contains ID3 content.
* <br/> - `'cea608'`: The track contains CEA608 content.
* <br/> - `'daterange'`: The track contains HLS EXT-X-DATERANGE content.
*
* @category Media and Text Tracks
* @public
*/
export let TextTrackType = /*#__PURE__*/function (TextTrackType) {
TextTrackType["cea608"] = "cea608";
TextTrackType["id3"] = "id3";
TextTrackType["srt"] = "srt";
TextTrackType["ttml"] = "ttml";
TextTrackType["webvtt"] = "webvtt";
TextTrackType["daterange"] = "daterange";
TextTrackType["eventstream"] = "eventstream";
TextTrackType["emsg"] = "emsg";
return TextTrackType;
}({});
/**
* The kind of the text track, represented by a value from the following list:
* <br/> - `'subtitles'`: The track contains subtitles.
* <br/> - `'captions'`: The track contains closed captions, a translation of dialogue and sound effects.
* <br/> - `'descriptions'`: The track contains descriptions, a textual description of the video.
* <br/> - `'chapters'`: The track contains chapter titles.
* <br/> - `'metadata'`: The track contains metadata. This track will not serve display purposes.
*
* @category Media and Text Tracks
* @public
*/
export let TextTrackKind = /*#__PURE__*/function (TextTrackKind) {
TextTrackKind["captions"] = "captions";
TextTrackKind["chapters"] = "chapters";
TextTrackKind["descriptions"] = "descriptions";
TextTrackKind["metadata"] = "metadata";
TextTrackKind["subtitles"] = "subtitles";
TextTrackKind["thumbnails"] = "thumbnails";
return TextTrackKind;
}({});
/**
* The mode of the text track, represented by a value from the following list:
* <br/> - `'disabled'`: The track is disabled.
* <br/> - `'hidden'`: The track is hidden.
* <br/> - `'showing'`: The track is showing.
*
* @remarks
* <br/> - A disabled track is not displayed and exposes no active cues, nor fires cue events.
* <br/> - A hidden track is not displayed but exposes active cues and fires cue events.
* <br/> - A showing track is displayed, exposes active cues and fires cue events.
*
* @category Media and Text Tracks
* @public
*/
export let TextTrackMode = /*#__PURE__*/function (TextTrackMode) {
TextTrackMode["disabled"] = "disabled";
TextTrackMode["showing"] = "showing";
TextTrackMode["hidden"] = "hidden";
return TextTrackMode;
}({});
/**
* Represents a text track of a media resource.
*
* @category Media and Text Tracks
* @public
*/
/**
* Retain renderable tracks.
*
* https://html.spec.whatwg.org/multipage/embedded-content.html#text-track-showing
*
* @category Media and Text Tracks
* @internal
*/
export function filterRenderableTracks(textTracks) {
return textTracks && textTracks.filter(textTrack => textTrack.kind === 'subtitles' || textTrack.kind === 'captions');
}
/**
* Retain first thumbnail track encountered in the textTracks list.
*
* @category Media and Text Tracks
* @internal
*/
export function filterThumbnailTracks(textTracks) {
return textTracks && textTracks.find(isThumbnailTrack);
}
/**
* Query whether a track is a valid thumbnail track.
*
* @category Media and Text Tracks
* @internal
*/
export function isThumbnailTrack(textTrack) {
return !!textTrack && (textTrack.kind === 'thumbnails' || textTrack.kind === 'metadata' && textTrack.label === 'thumbnails');
}
/**
* Query whether a track is a given cue.
*
* @category Media and Text Tracks
* @internal
*/
export function hasTextTrackCue(textTrack, cue) {
return !!(textTrack.cues && cue && textTrack.cues.find(c => cue.uid === c.uid));
}
/**
* Removes a cue from a text track.
*
* @category Media and Text Tracks
* @internal
*/
export function removeTextTrackCue(textTrack, cue) {
if (textTrack && textTrack.cues && cue && hasTextTrackCue(textTrack, cue)) {
textTrack.cues = textTrack.cues.filter(c => c.uid !== cue.uid);
}
}
/**
* Adds a cue to a text track.
*
* @category Media and Text Tracks
* @internal
*/
export function addTextTrackCue(textTrack, cue) {
if (textTrack && textTrack.cues && cue && !hasTextTrackCue(textTrack, cue)) {
textTrack.cues.push(cue);
}
}
/**
* Returns a cue from a text track by uid.
*
* @category Media and Text Tracks
* @internal
*/
export function findTextTrackByUid(textTracks, uid) {
return textTracks.find(t => t.uid === uid);
}
//# sourceMappingURL=TextTrack.js.map