Is there an Event after a Embed Youtube Video finished?

dohdoh0

Junior Member
Joined
Jul 9, 2010
Messages
117
Reaction score
7
Hey guys. My question are still visible in the topic

I would know if there is any event(handle) for embed youtube videos after they are finish..

I know I could grab the duration and make my stuff after this time but for this I need autoplay.. So hope anyone knows a handler, just foudn nothign inside the yt api docs.. (maybe I'm blind)

cheers, dAw
 
Your blind.. jp, its in the docs but the docs suck.

swfobject is your friend :)

Here is a very basic example including a video that accurately describes yt docs:
HTML:
<html>
<head>
<title></title>
<script type="text/javascript" src="swfobject.js"></script>
</head>
<body>

<div id="my_yt_player">You need Flash Fool!</div>

<script type="text/javascript">
var video_id = '35XI37SVVYI';	// youtube video id
var player_id = "my_yt_player";
var params = { allowScriptAccess: "always" };
var url = "http://www.youtube.com/e/" + video_id + "?enablejsapi=1&playerapiid=" + player_id;
swfobject.embedSWF(url, player_id, '480', '390', "9.0.0", null, null, params, {'id': player_id});

var player = null;

function onYouTubePlayerReady(player_id) {
  player = document.getElementById(player_id);
  player.addEventListener('onStateChange', 'playerFinished');
};

function playerFinished(response) {
  // response 0 means playback is finished
  if (response == 0) {
    console.log('all done!');
  }
};
</script> 

</body>
</html>
 
Your blind.. jp, its in the docs but the docs suck.

swfobject is your friend :)

Here is a very basic example including a video that accurately describes yt docs:
HTML:
<html>
<head>
<title></title>
<script type="text/javascript" src="swfobject.js"></script>
</head>
<body>

<div id="my_yt_player">You need Flash Fool!</div>

<script type="text/javascript">
var video_id = '35XI37SVVYI';    // youtube video id
var player_id = "my_yt_player";
var params = { allowScriptAccess: "always" };
var url = "http://www.youtube.com/e/" + video_id + "?enablejsapi=1&playerapiid=" + player_id;
swfobject.embedSWF(url, player_id, '480', '390', "9.0.0", null, null, params, {'id': player_id});

var player = null;

function onYouTubePlayerReady(player_id) {
  player = document.getElementById(player_id);
  player.addEventListener('onStateChange', 'playerFinished');
};

function playerFinished(response) {
  // response 0 means playback is finished
  if (response == 0) {
    console.log('all done!');
  }
};
</script> 

</body>
</html>

Just got: You need Flash Fool!:(
 
you can simply see it mate below,You need a flashplayer for that.
 
All Flash tools : Swf Player + JS files are available for free ;)
 
it works with sfw object but I got an (adobe flash) error in firefox and firefox freez.. :/
 
Back
Top