Posts

SEARCH VIDEOS AND SIMPLIFIED JSONP DEMO

About JSON and JSONP you can read in the internet Here I would like to present this issue as I understand. JSONP (JSON with Padding) is an unofficial method, a intelligent trick to overcome barriers when we want to transmit information between different domains. (author: Bob Ippolito http://bob.ippoli.to/archives/2005/12/05/remote-json-jsonp/) To use JSONP, first we need convert the information into a javascript object. Then this object is taken as an argument for a function with a certain name, eg "jsonCallback(...)" Because the user has written jsonpCallback function when the information comes to the client PC this function is trigged and the JSON (long string, a photo of the object) revives, becomes real object and start working under the user's program. There are two methods 1- Typical method: The user can give a name for function and then sent this name to remote server. To use typical method apart from Javascript, we have to know a server-side...

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...