Any idea how to disable auto play on embedded “Vine.co” videos?

ε祈祈猫儿з 提交于 2019-12-23 09:52:52

问题


I'm working on a little side project.

I'm able to embed and display specified vine.co video's with

<iframe id='eFrame' src='http://vine.co/v/bJjdTLBnwx1/card' width='380' height='380' frameborder='0'></iframe>

I'm pulling in the links via Ajax to display them on the page, however now the problem is they are all autoplaying, which causes major browser lag.

Anyone know how I can append them to the body with autoplay disabled? This project is all client side, so I'll be limited to client-side languages. (ie Javascript/jQuery etc..)

Much appreciated, Cheers.


回答1:


I'm probably late but you can pass some command via the postMessage javascript's function. It worked for me :

var iframe = document.getElementById(id);

iframe.contentWindow.postMessage('pause', '*');

Same construction for play, mute and unmute.




回答2:


<iframe id='eFrame' src='http://vine.co/v/bJjdTLBnwx1/embed/simple' width='320' height='320' frameborder='0'></iframe>

Try this it will be of much help have better controls and only on pressing the play button it will run.

Try it.



来源:https://stackoverflow.com/questions/14615370/any-idea-how-to-disable-auto-play-on-embedded-vine-co-videos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!