I'm using the jQuery Youtube plugin to embed a youtube video and use some of the API methods with the video.
I have the following code:
<div id="player"></div>
<script type="text/javascript">
jQuery("#player").tubeplayer({
width: 600, // the width of the player
height: 450, // the height of the player
allowFullScreen: "true", // true by default, allow user to go full screen
initialVideo: "VIDEO_ID", // the video that is loaded into the player
preferredQuality: "default",// preferred quality: default, small, medium, large, hd720
onPlay: function(id){}, // after the play method is called
autoPlay: true,
onPause: function(){}, // after the pause method is called
onStop: function(){}, // after the player is stopped
onSeek: function(time){}, // after the video has been seeked to a defined point
onMute: function(){}, // after the player is muted
onUnMute: function(){}, // after the player is unmuted
onPlayerEnded: function(){alert('ENDED')},
});
</script>
This plays the video fine, but when the video has ended, I'd expect the onPlayerEnded()
function to kick in and give me an alert('Ended')
, which it doesn't.
Has anyone used this plugin before point me in any direction as to why this is the case?
Many thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…