我在页面上有多个HTML5流播放器。如何让他们互相独占? [英] I have multiple HTML5 flowplayers on a page. How to I make them play mutually exclusively?

查看:152
本文介绍了我在页面上有多个HTML5流播放器。如何让他们互相独占?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有多个HTML5流媒体播放器实例。当我开始玩一个,然后点击另一个,第一个不停止。有没有办法配置它,以便一次只能播放一个?

I have Multiple HTML5 flow player instances on my page. When I start to play one, then click on another one, the first one doesn't stop. Is there any way to configure it so that only one will play at a time?

以下是测试页的代码:

<html>
<head>
    <script type="text/javascript"
        src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js">
    </script>

    <!-- 2. flowplayer -->
    <script type="text/javascript"
        src="//releases.flowplayer.org/5.4.1/flowplayer.min.js">
    </script>

    <!-- 3. skin -->
    <link rel="stylesheet" type="text/css"
        href="//releases.flowplayer.org/5.4.1/skin/minimalist.css">
    <title>title</title>
</head>
<body>
    <div>
        <div class="flowplayer">
            <video>
                <source type="video/mp4" src="PATH TO VIDEO 1">
            </video>
        </div>
    </div>
    <div>
        <div class="flowplayer">
            <video>
                <source type="video/mp4" src="PATH TO VIDEO 2">
            </video>
        </div>
    </div>
</body>
</html>


推荐答案

好的。终于找到了!这是一个名为Splash的功能

Ok. Finally found it! It's a feature called "Splash"

来自文档:


Flowplayer有一种称为启动画面的独特功能,与海报设置类似,不同之处在于嵌套的VIDEO或Flash OBJECT标签最初不在页面上,而是按需插入。当用户点击启动画面时,播放器即时安装。这有以下好处:
您可以在页面上拥有无限量的玩家,他们 - 或者更确切地说是他们的启动画面 - 即使在Flash模式下也会立即呈现。
没有隐藏的Flash对象会干扰您的脚本或CSS布局动态。
一次只能播放一个视频。当用户在另一个播放器实例运行时单击启动屏幕时,后者将自动卸载。
按照设计,启动设置还会禁用预加载视频。

Flowplayer has a unique feature called "splash screen" which is similar to the poster setup except that the nested VIDEO or Flash OBJECT tag initially is not present on the page, but is inserted on demand. The player is installed on the fly when the user clicks on the splash screen. This has the following benefits: You can have an unlimited amount of players on the page and they - or rather their splash screens - all render immediately, even in Flash mode. There are no hidden Flash objects which interfere with your scripting or CSS layout dynamics. Only one video can be played at a time. When the user clicks on a splash screen while another player instance is running, the latter is unloaded automatically. By design the splash setup also disables preloading of the video.

https://flowplayer.org/docs/setup.html#splash

这篇关于我在页面上有多个HTML5流播放器。如何让他们互相独占?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆