Chromecast是否支持TTML? [英] Does Chromecast support TTML?
问题描述
Chromecast开发者文档说WebVTT和TTML都是受支持的媒体类型: https://developers.google.com/cast/supported_media_types
The Chromecast developer docs say both WebVTT and TTML are Supported Media Types: https://developers.google.com/cast/supported_media_types
在视频元素内的跟踪"标签中使用WebVTT文件时,我看到了字幕:
I see captions when using a WebVTT file in a "track" tag within a video element:
<video id="vid" src="http://myurl">
<track kind="captions" src="http://10.16.236.23/test.vtt" srclang="en" label="English" default>
</video>
但是当我尝试使用有效的TTML文件执行相同操作时,看不到标题:
But when I try to do the same using a valid TTML file, I don't see captions:
<video id="vid" src="http://myurl">
<track kind="captions" src="test.ttml" srclang="en" label="English" default>
</video>
当我在调试器控制台中检查video元素时,对于WebVTT示例,我可以看到
When I inspect the video element in the debugger console, for the WebVTT example I can see
document.getElementById('vid').textTracks[0].cues.length;
16
但对于TTML:
document.getElementById('vid').textTracks[0].cues.length;
0
我对此是否正确,还是以其他方式支持TTML?也许Chromecast不支持我的TTML语法?
I am on the right track with this or is TTML supported in a different way? Maybe my TTML syntax is not supported by Chromecast?
推荐答案
根据 Cast Player API ,Chromecast现在支持WebVTT,TTML1和CEA-608(第21行字幕)字幕格式.只需将您的字幕格式的CaptionsType
枚举传递到播放器的 enableCaptions()
方法.
According to the Cast Player API, Chromecast now supports WebVTT, TTML1, and CEA-608 (Line 21 Captions) caption formats. Just pass in the CaptionsType
enum for your caption format into the player's enableCaptions()
method.
这篇关于Chromecast是否支持TTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!