-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
text: Add ISupportedTextTrackFormat concept
- Loading branch information
1 parent
c8c29c5
commit 40d24a3
Showing
20 changed files
with
175 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import bufferSourceToUint8 from "../../../../utils/buffer_source_to_uint8"; | ||
import { strToUtf8 } from "../../../../utils/string_parsing"; | ||
import parseMp4EmbeddedWebVtt from "../parse_mp4_embedded_wvtt"; | ||
import type { IVTTHTMLCue } from "./to_html"; | ||
import toHTML from "./to_html"; | ||
|
||
/** | ||
* Parse WebVTT subtitles format when embedded in an MP4 file. | ||
* @throws Error - Throws if the given WebVTT format. | ||
* @param {string | BufferSource} text - The whole webvtt subtitles to parse | ||
* @param {Number} timescale | ||
* @param {Number} timeOffset - Offset to add to start and end times, in seconds | ||
* @return {Array.<Object>} | ||
*/ | ||
export default function parseWebVTTMp4( | ||
text: string | BufferSource, | ||
timescale: number, | ||
timeOffset: number, | ||
): IVTTHTMLCue[] { | ||
if (typeof text === "string") { | ||
return parseMp4EmbeddedWebVtt(strToUtf8(text), timescale, timeOffset, toHTML); | ||
} | ||
return parseMp4EmbeddedWebVtt(bufferSourceToUint8(text), timescale, timeOffset, toHTML); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.