0

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

2 Answers 2

1

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

0

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]);
      }
1
  • Hi I've tried your code but it shows below err - SyntaxError: missing ) after argument list Sep 27, 2016 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.