Posts

Showing posts from November, 2015

PLAY VIDEOS WITHOUT USING API FOR IFRAME

The best way to write a web page playing youtube videos is to use API for iframe embeds. But here I try not to use api but work only with simple embed code and javascript. Suppose we have used another website to find a string of our favorite video ids. For example: st1 = 'IlSbsmPfSQA, X1Bhgl3izdU, 7Wr8fl5Yu0c' Then we use the following code to make a playlist <iframe id = "ifr1" src = "http://www.youtube.com/embed/?playlist='+st1+ &autoplay=1&enablejsapi=1" frameborder = "0" allowfullscreen> </ iframe> Web "non-api-playlist" works as follows: 1. After finding 250 videos (eg find "Ricky King"), I have to split the given string into two strings of 125 videos. Because YouTube does not let us use simple embed with more than 130 videos. 2. There are 2 buttons "playlist 1" and "playlist2" We will click on those buttons to shuffle arrays st1 or st2 function playArr(str){// shuffle s