Youtube Javascript API (Chromeless player) won't play some videos?
I'm using YouTubes javascript api to play videos (obviously). I've built my own custom controls and a little javascript script to get video IDs depending on a search term. It's all working perfectly, except some of the videos won't play. They open up fine in the player (which is made using swjobject jquery library) with the thumbnail displaying, but when I click play the video goes black and stops dead.
I have no javascript errors or anything. Am I querying youtubes API incorrectly and returning results which I'm not allowed to play, or something?
Thanks a lot!!
Request for code:
var params = { allowScriptAccess: "always" };
var atts = { id: "ytPlayer" };
swfobject.embedSWF("http://www.youtube.com/apiplayer?&enablejsapi=1&playerapiid=mojplayer", "videoBox", "480", "295", "8", null, null, params, atts);
I'm using that to embed the player, then using Youtubes functions to call a video by ID.
ytplayer = document.getElementById("ytPla开发者_C百科yer");
ytplayer.cueVideoById("p7kIKkqhn0k");
Also this is the link I'm using for the JSON:
http://gdata.youtube.com/feeds/api/videos?v=2&alt=jsonc&q=' + SearchQuery + '&category=Music&format=5
(Search query is the value of a input).
Quick edit: I've solved the problem by changing the embed code to another one off Youtubes docs.
精彩评论