1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is there an Event after a Embed Youtube Video finished?

Discussion in 'Social Networking Sites' started by dohdoh0, Jul 6, 2011.

  1. dohdoh0

    dohdoh0 Junior Member

    Joined:
    Jul 9, 2010
    Messages:
    114
    Likes Received:
    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
     
  2. RootShellvb

    RootShellvb Junior Member

    Joined:
    Jan 29, 2009
    Messages:
    188
    Likes Received:
    211
    Occupation:
    CEO
    Location:
    Casablanca, Morocco
    Home Page:
    I think it's possible if you are using Jwplayer :)
     
  3. Grizzy

    Grizzy Senior Member

    Joined:
    Nov 11, 2008
    Messages:
    919
    Likes Received:
    999
    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>
     
    • Thanks Thanks x 1
  4. dohdoh0

    dohdoh0 Junior Member

    Joined:
    Jul 9, 2010
    Messages:
    114
    Likes Received:
    7
    Just got: You need Flash Fool!:(
     
  5. Grizzy

    Grizzy Senior Member

    Joined:
    Nov 11, 2008
    Messages:
    919
    Likes Received:
    999
  6. Robvandam

    Robvandam Junior Member

    Joined:
    Jun 17, 2011
    Messages:
    142
    Likes Received:
    29
    you can simply see it mate below,You need a flashplayer for that.
     
  7. RootShellvb

    RootShellvb Junior Member

    Joined:
    Jan 29, 2009
    Messages:
    188
    Likes Received:
    211
    Occupation:
    CEO
    Location:
    Casablanca, Morocco
    Home Page:
    All Flash tools : Swf Player + JS files are available for free ;)
     
  8. dohdoh0

    dohdoh0 Junior Member

    Joined:
    Jul 9, 2010
    Messages:
    114
    Likes Received:
    7
    it works with sfw object but I got an (adobe flash) error in firefox and firefox freez.. :/