My Scenario - Codepen (Don't forget to scroll down)
I'm using the lazyframe plugin to lazyload my YouTube iframe videos. Each video gets added to the DOM after a click on the play button. There is a onAppend function included which gets triggered after a new video iframe is created (please have a look at the pen I created).
How can I stop the other vids after starting a new one?
I put a alert into the onAppend function to check if it works fine. The onAppend part looks like
onAppend: function(e) { alert('onAppend after Lazyframe Function'); }I also managed to include the following scripts
<script src="http://www.youtube.com/player_api"></script><script src="http://www.youtube.com/iframe_api"></script>The part at the end of the embed YoutTube URL to enable the API is also include
&enablejsapi=1Each Iframe gets a unique id
<iframe id="lazyframe-6hgVihWjK2c" src="https://www.youtube.com/embed/6hgVihWjK2c/?autoplay=1" allowfullscreen="" class="test-vidx" frameborder="0"></iframe>Any help would be appreciated.