Youtube embeded action when video ends

后端 未结 2 1747
隐瞒了意图╮
隐瞒了意图╮ 2021-01-07 00:15

I wonder if it is possible to make an action with youtube api when embeded video finishes. For example, in my web i start video on hover of one element, but i want video tu

2条回答
  •  离开以前
    2021-01-07 00:53

    use http://www.tikku.com/jquery-youtube-tubeplayer-plugin

    It makes everything easy. Once you have it set up, which shouldn't take long (there is an easy how-to), simply add this line to you player initiation:

        onPlayerEnded: function(){ // Do something here },
    

    This will do whatever you want after the player ends. There are also callbacks for when the player is paused, stopped, played, muted, unmuted, queued, and more

    Let me know if this works, or if you have trouble using the jquery plugin. It really is very helpful and easy!

提交回复
热议问题