Embedding YouTube Playlist using SWFObject.embedSWF()

I'm trying to use YouTube's JavaScript API to embed a playlist to my Facebook app.

I tried using the standard code as shown by Google here to embed a simple video and it worked.

The code is:

    function loadPlayer() {
        // The video to load
        var videoID = "[My Video ID]";
        // Lets Flash from another domain call JavaScript
        var params = { allowScriptAccess: "always" };
        // The element id of the Flash embed
        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 + 
                           "?fs=1&version=3&enablejsapi=1&playerapiid=player1", 
                           "videoDiv", "420", "315", "9", null, null, params, atts);
      }

But how do I use the YouTube API to embed a Playlist ?

I'm aware of the playlist parameter on the embedSWF URL parameter, but what it does is append videos as to make a playlist on the fly.

I already have a playlist on my YouTube account, now I want to embed it using the API.

How can this be done?

Thanks!


I'm working on something similar and in looking for the solution to my problem may have found yours...

In the place where you have;

swfobject.embedSWF("http://www.youtube.com/v/" + videoID + 

Change that to:

swfobject.embedSWF("http://www.youtube.com/p/" + playlistID + 

I do believe that will work. That's what puts our playlist on the player. And yet, it is not the way we are hoping to display it. We would like a list below the player, so I am still searching for that answer.

I hope this helps you!


你不需要JavaScript或任何东西,你只需进入你的播放列表,并旁边播放所有按钮它说共享,单击,然后单击嵌入并复制并通过您的网站上的代码。


这可以帮助你尝试你自己的... http://jsfiddle.net/masiha/tFQEN/1/

链接地址: http://www.djcxy.com/p/28946.html

上一篇: 如何将YouTube视频嵌入播放列表

下一篇: 使用SWFObject.embedSWF()嵌入YouTube播放列表