glubs/webvtt
Types
Item represents an individual item in a WebVTT file, which can be either a Note or a Cue.
pub type Item {
Note(String)
Style(String)
Cue(
id: Option(String),
start_time: Int,
end_time: Int,
payload: String,
settings: List(#(String, String)),
)
}
Constructors
-
Note(String)
-
Style(String)
-
Cue( id: Option(String), start_time: Int, end_time: Int, payload: String, settings: List(#(String, String)), )
Token represents individual tokens that can be generated during the tokenization of WebVTT cue payload.
pub type Token {
StartTag(
tag: String,
classes: List(String),
annotation: Option(String),
)
Text(content: String)
Timestamp(ms: Int)
EndTag(tag: String)
}
Constructors
-
StartTag( tag: String, classes: List(String), annotation: Option(String), )
-
Text(content: String)
-
Timestamp(ms: Int)
-
EndTag(tag: String)
TokenizationError represents errors that may occur during the tokenization process.
pub type TokenizationError {
InvalidStartToken
InvalidEndToken
}
Constructors
-
InvalidStartToken
-
InvalidEndToken
Functions
pub fn parse(webvtt: String) -> Result(WebVTT, String)
Parses a WebVTT string and returns a Result containing the parsed WebVTT structure or a parsing error.