我正在使用Flowplayer作为客户端的自定义Intranet,并使用CKEditor添加页面内容。在HTML中无法访问网站的HEAD,所以我一直在使用内联CSS语法。
客户端要求在点击播放之前在播放器区域中显示图像。我可以只使用内联CSS获得启动画面或海报吗?
<p>Here is a new sample video.</p>
<script src="http://releases.flowplayer.org/js/flowplayer-3.2.12.min.js"></script>
<div id="clip01" style="margin:0px auto; width:500px;height: 300px; text-align:center; background-image:url('http://31.media.tumblr.com/tumblr_lrqfj1ELAQ1qzi2ewo1_500.jpg');"></div>
<script>
$f("clip01", "http://releases.flowplayer.org/swf/flowplayer-3.2.16.swf", {
clip: {
url: 'mp4:vod/demo.flowplayervod/bbb-800.mp4',
scaling: 'fit',
autoPlay: false,
autoBuffering: true,
provider: 'rtmp'
},
plugins: {
rtmp: {
url: "flowplayer.rtmp-3.2.12.swf",
netConnectionUrl: 'rtmp://rtmp01.hddn.com/play'
}
},
canvas: {
backgroundGradient: 'none'
}
});
</script>
到目前为止,我没有尝试过显示背景图片。播放器以黑色背景加载。
这是一个小提琴:http://jsfiddle.net/GuVbJ/
答案 0 :(得分:2)
您需要做的就是在流程图div
内放置一张图片。然后,Flowplayer将图像用作启动画面。当您点击图片时,视频将会播放。
示例强>
<script src="http://releases.flowplayer.org/js/flowplayer-3.2.12.min.js"></script>
<div id="clip01" style="margin:0px auto; width:500px;height: 300px; text-align:center;">
<img src="http://31.media.tumblr.com/tumblr_lrqfj1ELAQ1qzi2ewo1_500.jpg" alt="Bacon" />
</div>
<script>
$f("clip01", "http://releases.flowplayer.org/swf/flowplayer-3.2.16.swf", {
clip: {
url: 'mp4:vod/demo.flowplayervod/bbb-800.mp4',
scaling: 'fit',
autoBuffering: true,
provider: 'rtmp'
},
plugins: {
rtmp: {
url: "flowplayer.rtmp-3.2.12.swf",
netConnectionUrl: 'rtmp://rtmp01.hddn.com/play'
}
},
canvas: {
backgroundGradient: 'none'
}
});
</script>
请参阅jsFiddle
有关初始屏幕的详细信息,请参阅flowplayer docs
答案 1 :(得分:0)
CSS只会很难,你可以使用js为它设置div并在播放时删除。
答案 2 :(得分:0)
Flowplayer no longer offers 独立播放器。旧版本仍然可以使用 GPL v3 许可证,因此这里有一个不依赖于 Flash 的解决方案:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flowplayer/7.2.4/skin/skin.css">
<style>
body {
font-family: verdana, tahoma, arial, sans-serif;
font-size: 14px;
margin: 0;
padding: 0;
}
#content {
margin: 50px auto;
max-width: 500px;
}
#css-poster {
background-image: url(https://31.media.tumblr.com/tumblr_lrqfj1ELAQ1qzi2ewo1_500.jpg);
background-color: #000;
background-size: 200%;
-webkit-transition: background 1s .5s;
-moz-transition: background 1s .5s;
transition: background 1s .5s;
}
#css-poster.is-poster {
background-size: 100%;
}
</style>
<div id="content">
<div id="css-poster" data-aspect-ratio="47:25" class="flowplayer no-volume">
<video>
<source type="video/webm" src="https://edge.flowplayer.org/black/470x250.webm">
<source type="video/mp4" src="http://p.demo.flowplayer.netdna-cdn.com/vod/demo.flowplayer/bbb-800.mp4">
</video>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/flowplayer/7.2.4/flowplayer.min.js"></script>
这是 fiddle。