我有一个m3u8流,该文件没有m3u8扩展名,但无法播放。如果我更改扩展名,那么它可以工作。我认为这是因为github上的CastPlayer示例中的player.js
。
if (sampleplayer.getExtension_(path) === 'm3u8' ||
type === 'application/x-mpegurl' ||
type === 'application/vnd.apple.mpegurl') {
return cast.player.api.CreateHlsStreamingProtocol;
} else if (sampleplayer.getExtension_(path) === 'mpd' ||
type === 'application/dash+xml') {
return cast.player.api.CreateDashStreamingProtocol;
} else if (path.indexOf('.ism') > -1 ||
type === 'application/vnd.ms-sstr+xml') {
return cast.player.api.CreateSmoothStreamingProtocol;
}
由于我的标题没问题,是否可以使用标题而不是扩展名?
感谢。
答案 0 :(得分:1)
也许我并不完全理解您的问题,但由于您使用的是自定义接收器,请随意根据需要进行更改。
答案 1 :(得分:0)
{...}这段代码目前实现了一个简单的解析器来弄清楚 内容类型基于文件的扩展名。这是例如 只要;你应该实现自己的机制来做到这一点。
我认为这意味着如果你能够以其他方式确定流类型,那就去吧。