HTML5视频播放器:动态加载视频
那么,使用兼容 HTML 5 的视频播放器(如 Video JS),如何动态加载视频,而无需重新加载整个页面呢?想象一下,一个链接列表(类似于播放列表),每个链接都指向一个视频。单击链接时,我想将所选视频加载到播放器中。
目前,我正在使用一个包含视频播放器的 Iframe,因此基本上我将一个变量传递到 Iframe,然后重新加载它。我认为这并不理想,原因如下:它不允许视频全屏显示,“后退”按钮不仅会将 Iframe 移回到主页,而且它还是一个 Iframe。我宁愿避免这种情况。
有想法吗?谢谢!
So, using a HTML 5 compliant video player, (like Video JS) how would one go about loading a video dynamically, without having to reload the entire page? Imagine, a list of links (something like a playlist), and each link points to a video. When clicking the link, I want to load the selected video into player.
Currently, I'm using an Iframe that holds the video player, so basically a I pass a variable on to the Iframe, and reload it. I don't think this is ideal, for a few reasons; it doesn't allow the video to go full screen, the Back button moves the Iframe back not just the main page, plus, it's an Iframe. I'd rather avoid this.
Ideas? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想出了一个简单的解决方案。这是脚本;将其放入头部:
然后 HREF 将调用该函数:
Came up with a simple solution. Here's the script; throw this in the head:
And then the HREF will call the function: