How to Play a Playlist using YouTube JavaScript API

前端 未结 3 1706
花落未央
花落未央 2021-02-02 00:18

I\'m trying to play a youtube playlist using this JavaScript API for iframe-embeds introduced this January. http://apiblog.youtube.com/2011/01/introducing-javascript-player-api-

3条回答
  •  萌比男神i
    2021-02-02 00:44

    A simple solution that does not require the YouTube IFrame (JavaScript) API is discussed on Embed YouTube Videos, Playlists and More with IFrame Embeds. You can copy the video embed code (iframe version) from one of the videos on YouTube and tweak it like this:

    
    

    Note that there is no video id... instead, the listType and list parameters instruct the player to load a playlist. For your particular requirement, add autoplay=1 to ensure that the videos play automatically without requiring JavaScript code.

提交回复
热议问题