liron
liron

Reputation: 31

Is it possible to create my own youtube playlist with Youtube Api

Is it possible to create my own YouTube playlist with YouTube API?

I would like to take a list of YouTube id's, and append the videos to my page.

Is it possible?

Thank you

Upvotes: 1

Views: 4606

Answers (2)

jasenkoh
jasenkoh

Reputation: 4161

HTML:

<div id="player"></div>

Javascript:

      var tag = document.createElement('script');

      tag.src = "https://www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);


      var player;
      function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          videoId: 'M7lc1UVf-VE',
          events: {
            'onReady': onPlayerReady
          }
        });
      }

      function onPlayerReady(event) {
        //here you load your playlist
        event.target.loadPlaylist(playlist: [youtubeIds]);
      }

Upvotes: 0

Ibrahim Ulukaya
Ibrahim Ulukaya

Reputation: 12877

Yes, you can create a playlist with playlists->insert.

Upvotes: 2

Related Questions