2016-07-04 124 views
0

我正在创建一个用于流式传输视频并使用流式VTT字幕的Chromecast应用程序。我已经成功地管理加载TTML,但我需要还加载VTT为了这个,我有以下代码Chromecast VTT未显示

this.player.enableCaptions(true, 'vtt', 'http://some_file.vtt'); 

失败的MediaPlayer.js内的tyhe以下错误

Uncaught TypeError: Cannot read property 'parse' of null 

这看起来是在加载单个线索的代码中有没有人遇到过这个问题?

+0

VTT应该已经WebVTT插入 – Deviland

回答

0
this.player.enableCaptions(true, 'vtt', 'http://some_file.vtt'); 

应该

this.player.enableCaptions(true, 'webvtt', 'http://some_file.vtt'); 
0

您需要将(文本/音频)音轨信息添加到MediaInfo中,然后设置活动音轨。看看这个guide。另外请注意,即使您的媒体是mp4,也需要使用CORS。