HTML Auto Embedding Recent Uploaded videos from a youtube channel -
i wondering there way auto embed recent uploads youtube channel website? don't know start. help?
<!doctype html> <html> <head> <title>youtube recent upload thing</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> </head> <body> <div id="static_video"></div> <script type="text/javascript"> function showvideo(response) { if(response.data && response.data.items) { var items = response.data.items; if(items.length>0) { var item = items[0]; var videoid = "http://www.youtube.com/embed/"+item.id; console.log("latest id: '"+videoid+"'"); var video = "<iframe width='420' height='315' src='"+videoid+"' frameborder='0' allowfullscreen></iframe>"; $('#static_video').html(video); } } } </script> <script type="text/javascript" src="https://gdata.youtube.com/feeds/api/users/urusernamehere/uploads?max-results=1&orderby=published&v=2&alt=jsonc&callback=showvideo"></script> </body> </html>
Comments
Post a Comment