How to catch youtube video player's Play/Pause event using Javascript?
12,899
Check this example below, we can do it using Youtube Player API
http://jsfiddle.net/masiha/4mEDR/
Related videos on Youtube
Author by
aslamdoctor
Full Stack Web Developer WordPress, Laravel, VueJS & NuxtJS
Updated on September 16, 2022Comments
-
aslamdoctor over 1 year
Possible Duplicate:
Make callback after play button is pushed - Youtube embed videoI have a Youtube video embeded on my website. The code is as below
<iframe width="280" height="180" frameborder="0" src="http://www.youtube.com/embed/U5BVeZybEV4" title="YouTube video player" allowfullscreen></iframe>
What I want to do is, when I click on Play button of the Video, it should execute a javascript alert function as
alert("Clicked Play");
Same way, if I click on Pause button, it should execute a javascript alert function as
alert("Clicked Pause");
Any suggestion how can I catch these Events ?
Thanks in advance.