YouTube Playlist - Show playlist on page load

扶醉桌前 提交于 2019-12-24 12:13:11

问题


I'm trying to figure out how to have the playlist automatically be expanded on page load as seen in this screen shot - http://glui.me/?i=zg8yl7mc2ukewck/2015-01-14_at_2.57_PM.png/

Right now when you load the page it displays closed as shown here http://glui.me/?i=md1ar6v3jfhb54b/2015-01-14_at_2.58_PM.png/

I am not using the API currently. I just have a playlist I generated on YouTube and copied the iframe embed code and popped it on the page. Is there anything I can add to the URL to achive this? Such as how you can turn off the recommended videos at the end with &rel=0


回答1:


Me too.

Unable not find any solution. The 'enablejsapi' parameter looked promising.

I did find this enhancement request.

(https://code.google.com/p/gdata-issues/issues/detail?id=5890&q=playlist%20show&colspec=API%20ID%20Type%20Status%20Priority%20Stars%20Summary)

Vote it up!




回答2:


You and me both. My research is leading me to believe that this is impossible with the iFrame embed. I'm currently working with an ad-hoc playlist (https://developers.google.com/youtube/player_parameters#playlist), and it seems that there's no way to force the native playlist to open automatically.

I've seen a few solutions around that add in a separate playlist element to the page (http://www.woosterwebdesign.com/responsive-youtube-player-with-playlist/ , http://jsfiddle.net/NmvA9/7432/), but that's not the integrated solution we're looking for either.

The jsfiddle uses this code to create the carousel:

    function createCarousel(jqe, videos, options) {
    var car = $('div.carousel', jqe);
    if (car.length === 0) {
        car = $('<div>');
        car.addClass('carousel');
        jqe.append(car);

    }
    $.each(videos, function(i,video) {
        options.thumbnail(car, video, options); 
    });


来源:https://stackoverflow.com/questions/27951400/youtube-playlist-show-playlist-on-page-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!