Chromecast 通过其媒体播放器库支持 SmoothStreaming 内容:https ://developers.google.com/cast/docs/player
下面是一个简单的实现。
Google 在 GitHub 上提供了一个适当的示例,该示例利用了 MediaManager 并考虑了其他流格式:https ://github.com/googlecast/CastMediaPlayerStreamingDRM )
var $mediaElement = $('<video>').attr('autoplay', ''),
mediaElement = $mediaElement[0],
mediaUrl = "http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest",
mediaHost,
mediaPlayer;
cast.receiver.CastReceiverManager.getInstance().start();
$('body').append(mediaElement);
mediaHost = new cast.player.api.Host({
mediaElement: mediaElement,
url: mediaUrl
});
var protocol = cast.player.api.CreateSmoothStreamingProtocol(mediaHost);
mediaPlayer = new cast.player.api.Player(mediaHost);
mediaPlayer.load(protocol);