1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Redirect to another URL after embedded YouTube video ends - possible?

Discussion in 'Programming' started by Brandon Tanner, Dec 12, 2008.

  1. #1
    Anyone know if this can be done by inserting some HTML or Javascript into the YouTube embed code? I don't think a time-delayed redirect would be good, as it would redirect some viewers too early (for example those that get hung up with longer video buffering times, etc).

    Is there a simple way to detect when the video has finished playing, then redirect based on that?

    Thanks
     
    Brandon Tanner, Dec 12, 2008 IP
  2. islandhopper8

    islandhopper8 Active Member

    Messages:
    100
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    73
    #2
    islandhopper8, Dec 17, 2008 IP
  3. rajib.bahar

    rajib.bahar Active Member

    Messages:
    87
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    68
    #3
    One way I would do this by knowing when the video ends.

    Create a javascript function all the way at the bottom of the page before the ending body tag. When the page loads (body OnLoad function) run that function and have it wait for total seconds that video plays.

    How can you get the time it ends?

    See the RSS feed exposed by my youtube page (http://www.youtube.com/rajib2k5)

    http://www.youtube.com/api2_rest?method=youtube.videos.list_by_user&dev_id=Fwv7KWPaxvw&user=rajib2k5&page=1&per_page=10

    There is a xml node namely length_second. That tells you how long that video runs for. Get that information via youtube api. You're all set after that.

    Let me know if this helps.

    Good luck!!!
     
    rajib.bahar, Dec 18, 2008 IP
  4. islandhopper8

    islandhopper8 Active Member

    Messages:
    100
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    73
    #4
    Yea, that is a nice way, however if the person pause the video or if the internet is slow and it have to get the info the time will be off. So you will have times that it will stop before the video really done.
     
    islandhopper8, Dec 18, 2008 IP
    rajib.bahar likes this.
  5. rajib.bahar

    rajib.bahar Active Member

    Messages:
    87
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    68
    #5
    Those are good scenarios to test... The OnLoad function will trigger after everything is loaded. It'll be challenging to find out if the video connection is slow or not. I have not researched that aspect of the youtube api. My approach would work after everything is loaded. You're right that it does not account for video server connectivity issue. There are times YouTube is down for maintenance... What do you do then? My recommended approach is not the only way. I am looking forward to other solutions and what you ultimately decide. :)

    Depending on the end user or client you are serving, you have to make some assumption and/or trade off. Sorry I could not be of more help there.

    For your good question I added a plus to your reputation.
     
    rajib.bahar, Dec 18, 2008 IP
  6. islandhopper8

    islandhopper8 Active Member

    Messages:
    100
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    73
    #6
    I am also interested in a solution, however I want to make a play list with links to different video providers, like youtube, googlevideo,dailymotion etc. I have now that I can play those on my website, however I would love to make it possible so that you can make a playlist with the music videos that are there. So that each visitor can make their own favorite top 10. So if someone has some good ideas how to go about it I also would love to hear about it.
     
    islandhopper8, Dec 19, 2008 IP
  7. dcwilliam1

    dcwilliam1 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    hte only way to figure that out would be to reference the youtube api. if its not somewhere in there, you'd have to ask a developer on the youtube site.
     
    dcwilliam1, Dec 19, 2008 IP