javascript 如何为 html5 播放器实现 chromecast 支持

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31937269/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 14:37:00  来源:igfitidea点击:

How to implement chromecast support for html5 player

javascripthtmlhtml5-videochromecast

提问by Sathibabu P

I have designed an html5 player with some custom functionalities using js and html5,now i need to add chrome cast option on html5 player like https://raw.githubusercontent.com/kim-company/videojs-chromecast/master/screenshots/chromecast-player.jpg

我已经使用 js 和 html5 设计了一个具有一些自定义功能的 html5 播放器,现在我需要在 html5 播放器上添加 chrome cast 选项,如 https://raw.githubusercontent.com/kim-company/videojs-chromecast/master/screenshots/chromecast -player.jpg

The below is the link for designed html5 player https://player14123141.herokuapp.com/

以下是设计的 html5 播放器的链接 https://player14123141.herokuapp.com/

Thanks for your help.

谢谢你的帮助。

回答by Leon Nicholls

You can reuse your HTML5 player by implementing the following Google Cast Receiver interface: https://developers.google.com/cast/docs/reference/receiver/cast.receiver.media.Player

您可以通过实现以下 Google Cast Receiver 接口来重复使用您的 HTML5 播放器:https: //developers.google.com/cast/docs/reference/receiver/cast.receiver.media.Player

You then specify your interface implementation as the media element for the MediaManager: https://developers.google.com/cast/docs/reference/receiver/cast.receiver.MediaManager

然后,您将接口实现指定为 MediaManager 的媒体元素:https: //developers.google.com/cast/docs/reference/receiver/cast.receiver.MediaManager