2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by martin5211
1

This example will show an alert after the end.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>    
<div id="ytapiplayer">
  You need Flash player 8+ and JavaScript enabled to view this video.
</div>

<script type="text/javascript">
 
    var params = { allowScriptAccess: "always" };
    var atts = { id: "myytplayer" };
    swfobject.embedSWF("http://www.youtube.com/v/App5FjQMpdA?enablejsapi=1&playerapiid=ytplayer", 
                       "ytapiplayer", "425", "356", "8", null, null, params, atts);

function onYouTubePlayerReady(playerId) {
  ytplayer = document.getElementById("myytplayer");
  ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
}

function onytplayerStateChange(newState) {
	if(newState == 0){
   		alert("Player is stopped");
	}
}

</script>

Edited by martin5211: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.