Summary
I have an unnamed Youtube API player in my Flex / AS3 app. Sometimes I need a player to play movies continuously from Youtube (non-stop).
Questions
After playing for something like 12 or more hours, the API token that was generated by the first player initialization request has expired.
http:
And the problem here is that the API call loadVideoById , which is called again after the token expires, cannot start playing the video, because the token is not updated automatically.
After playing our playlist (each element gets a call when loadVideoById is called) for something like 4-5 or more hours, when the video sometimes starts playing and suddenly gets stuck. Until an error message is sent.
Known Solutions
So, for the first problem, the solution is to update the token every 12 hours by unloading the player and downloading it again using an API call:
http:
There are no ideas in the second problem. You need your help.
Corresponding source code
private function CreateYoutubePlayerSWF():void { ... theYoutubeLoader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit); theYoutubeLoader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3&modestbranding=1&autoplay=0")); ... } private function PlayPendingVideo():void { ... theYoutubePlayer.loadVideoById(videoWaitingToPlayInfo.videoWaitingToPlay); ... }
Requests and Answers
When a player stops playing, this is what I get in the violinist:
"request": { "method": "GET", "url": "http://www.youtube.com/get_video?cpn=Lj5HaLu7MzS5kG-T&fmt=35&splay=1&t=vjVQa1PpcFNwMVrYUDFOTTG-7co1uJFo3oyrB-qoP_k=&video_id=j-vJJSqw5Q4&eurl=http%3A%2F%2Fwatchitoo.com%2Fiframe.php%3Fid%3Dwwa-154%26scale%3Dfalse%26layout%3D14&asv=3&el=embedded&ps=chromeless&ptk=youtube_none&noflv=1", ... "queryString": [ { "name": "cpn", "value": "Lj5HaLu7MzS5kG-T" }, { "name": "fmt", "value": "35" }, { "name": "splay", "value": "1" }, { "name": "t", "value": "vjVQa1PpcFNwMVrYUDFOTTG-7co1uJFo3oyrB-qoP_k" }, { "name": "video_id", "value": "j-vJJSqw5Q4" }, { "name": "eurl", "value": "http%3A%2F%2Fwatchitoo.com%2Fiframe.php%3Fid%3Dwwa-154%26scale%3Dfalse%26layout%3D14" }, { "name": "asv", "value": "3" }, { "name": "el", "value": "embedded" }, { "name": "ps", "value": "chromeless" }, { "name": "ptk", "value": "youtube_none" }, { "name": "noflv", "value": "1" }
"response": { "status": 410, "statusText": "Gone", "httpVersion": "HTTP/1.1", "headers": [ { "name": "Date", "value": "Wed, 26 Jun 2013 16:32:37 GMT" }, { "name": "X-Content-Type-Options", "value": "nosniff" }, { "name": "Server", "value": "Apache" }, { "name": "X-Frame-Options", "value": "SAMEORIGIN" }, { "name": "Content-Type", "value": "video/x-flv" }, { "name": "Cache-Control", "value": "no-cache" }, { "name": "Content-Length", "value": "0" }, { "name": "Expires", "value": "Tue, 27 Apr 1971 19:44:06 EST" }