0

There's no message error https://jsfiddle.net/f197cjty/ so I can't see why it doesn't play youtube

    <div id="ytplayer"></div>

    <script>
    // 1. ytplayer code: https://developers.google.com/youtube/player_parameters#IFrame_Player_API

    (
        function(){
            
            var s = document.createElement("script");
            s.src = "http://www.youtube.com/player_api";

            var before = document.getElementsByTagName("script")[0];
            before.parentNode.insertBefore(s, before);

        }
    )();


    var player;


    function onYouTubePlayerAPIReady() 
    {
            player = new YT.Player('ytplayer', 
            {
              height: '390',
              width: '640',
              playerVars: 
              {
                listType:'playlist',
                list: 'RDEMe12_MlgO8mGFdeeftZ2nOQ'
              }
            });
    }



     </script>
1
  • Just a typo for https protocol Commented Apr 13, 2021 at 15:29

1 Answer 1

5

You are trying to run an http script in an https environment. Change the url for YouTube to https://www.youtube.com/player_api.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.