Here is my code, i’m pretty sure it’s OK but it doesn’t seem to be working. Maybe a second point of view might help. entries are search results.
function showMyVideos(data) {
var feed = data.feed;
var entries = feed.entry || [];
var html = ['<ul>'];
for (var i = 0; i < entries.length; i++)
{
var entry = entries[i];
var playCount = entry.yt$statistics.viewCount.valueOf() + ' views';
var title = entry.title.$t;
var lnk = '<a href = \"' + entry.link[0].href + '\">linkcik</a>';
var entPar = objToString(entry.id);
var parseEntries = entPar.split("/");
var videoID = parseEntries[5].substring(0,11)
var params = { allowScriptAccess: "always" };
var atts = { id: "ytPlayer" };
// All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "?version=3&enablejsapi=1&playerapiid=player1",
"videoDiv", "480", "295", "9", null, null, params, atts);
html.push('<li>', title, ', ', playCount, ', ', lnk, '</li>');
}
html.push('</ul>');
document.getElementById('videoResultsDiv').innerHTML = html.join('');
}
I’ve never used swfobject but from what I’m seeing you’ve created a swf object and are asking it to be added to the videoDiv element. Are you sure you want this behaviour ?
Because from where I’m standing I think you should have used the createSWF method and added the returned object to your html array.