Plone flowplayer 不会自动启动视频
我不确定为什么 flowplayer 不会自动启动视频,您必须按播放才能启动。自动播放似乎没有效果。
<tal:js metal:fill-slot="javascript_head_slot">
<script type="text/javascript">
flowplayer("player1", "flowplayer.swf",
{ clip: { autoPlay: true, autoBuffering: true } }
);
</script>
</tal:js>
如果需要任何其他编码,请告诉我。
I'm not sure why flowplayer won't automatically start the video, you have to press play in order to start. The autoplay doesn't seem to have an effect.
<tal:js metal:fill-slot="javascript_head_slot">
<script type="text/javascript">
flowplayer("player1", "flowplayer.swf",
{ clip: { autoPlay: true, autoBuffering: true } }
);
</script>
</tal:js>
If any other coded is needed, let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设你的player1元素里面包含HTML元素或文本,例如:
如果你想要自动播放,它必须是空的:
I suppose your player1 element contains HTML element or text inside, for example:
If you want autoplay, it has to be empty:
不管出于什么原因,这部分 js 代码没有执行或被 Plone 覆盖,所以我删除了上面的所有 js 代码。
plone 的 flowplayer 使用一个
init.js
脚本。在那里,您可以看到它在div
标记内查找a
标记,因此我更改了 html 代码来反映这一点。另外,我给了我的div另一个类(autoPlayVideo),这样我在init.js
中添加的代码就可以识别div
内部的flowplayer并让它自动播放(auto如果视频位于 div 中并且没有启动图像,则播放视频)。任何使用init.js
的其他内容都不会受到影响。之前的html:
之后的 html (不再需要“player1”id):
init.js:
如果其他人有更好的解决方案,请分享:-)
For whatever reason that portion of js code wasn't executing or being overwritten by Plone so I got rid of all that js code on top.
There is an
init.js
script that plone's flowplayer uses. In there you can see that it looks for ana
tag inside adiv
tag so I changed my html code to reflect that. In addition, I gave my div another class (autoPlayVideo) so that the code I added ininit.js
can recognize the flowplayer inside thediv
and let it auto play (auto play the video if it's in a div and does not have a splash image). Anything else that usesinit.js
won't be affected.html before:
html after (There is no "player1" id needed anymore):
init.js:
If anyone else has an even better solution, please share :-)