79301505

Date: 2024-12-22 18:40:13
Score: 1.5
Natty:
Report link

I think this was changed at some point. You can do this now with enablejsapi=1 in the URI

<iframe id="yt-iframe"
    width="640" height="360"
    src="https://www.youtube.com/embed/uNDfgnWN2G0?rel=0&enablejsapi=1&playlist=IJrwmIQqj5s,uNDfgnWN2G0,pDf46hYF4CE&enablejsapi=1"
    frameborder="0"
></iframe>

Then create a script to interact with your iframe

  var tag = document.createElement('script');
  tag.id = 'iframe-demo';
  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('yt-iframe', {
    events: {
      'onReady': onPlayerReady,
      'onStateChange': onPlayerStateChange
    }
    });
  }

  function onPlayerReady(event) {
    player.playVideoAt(2); // start at 2nd video
  }
  function onPlayerStateChange(event) {
  }

Reference: https://developers.google.com/youtube/iframe_api_reference#Playback_controls

Reasons:
  • Blacklisted phrase (1): youtube.com
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: glitchyme