TTMLParser
Defined in: parser.ts:56
TTML 歌词生成器类
用于将 AMLL 项目使用的 TTML 字符串解析为结构化的 TTMLResult 数据结构
https://github.com/amll-dev/amll-ttml-db/wiki/%E6%A0%BC%E5%BC%8F%E8%A7%84%E8%8C%83
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TTMLParser(options?): TTMLParser;Defined in: parser.ts:81
构造一个 TTML 解析器实例
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? | TTMLParserOptions | 生成器配置选项 在 Node.js 环境下必须注入 domParser 实例(例如用 @xmldom/xmldom 等) |
Returns
Section titled “Returns”TTMLParser
Methods
Section titled “Methods”parse()
Section titled “parse()”parse(xmlStr): TTMLResult;Defined in: parser.ts:111
解析 TTML 字符串
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
xmlStr | string | 需要解析的 TTML XML 字符串 |
Returns
Section titled “Returns”解析后的结构化 TTML 数据结构
Throws
Section titled “Throws”当输入的 XML 字符串格式无效时抛出异常
parse()
Section titled “parse()”static parse(xmlStr, options?): TTMLResult;Defined in: parser.ts:100
解析 TTML 字符串的静态便捷方法
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
xmlStr | string | 需要解析的 TTML XML 字符串 |
options? | TTMLParserOptions | 解析器配置选项,用于注入 DOM 依赖 |
Returns
Section titled “Returns”解析后的结构化 TTML 数据结构
Throws
Section titled “Throws”当输入的 XML 字符串格式无效时抛出异常