parseTTML
function parseTTML(ttmlText): AmllLyricResult;Defined in: index.ts:22
将 TTML 格式的 XML 字符串解析为 AmllLyricResult 对象的便捷方法
若需要原始的、内容更丰富的 TTMLResult 结构,建议直接使用 TTMLParser 类
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ttmlText | string | 符合 TTML 规范的 XML 字符串 |
Returns
Section titled “Returns”解析后的 AmllLyricResult 对象,包含歌词行列表和元数据
Remarks
Section titled “Remarks”默认使用全局的 DOMParser,若为 Nodejs 环境,必须使用
TTMLParser 类注入 DOMParser 实现,例如 @xmldom/xmldom
Throws
Section titled “Throws”如果没有全局的 DOMParser,抛出错误