Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

I have a YouTube video that when it finishes I would like to redirect to another page on my website

$
0
0

I have the video playing correctly, and there are several answers to my question on here but I can't for the life of me figure out where to append any of the solutions into my working code below

<div id="ytplayer"></div><script>  // Load the IFrame Player API code asynchronously.  var tag = document.createElement('script');  tag.src = "https://www.youtube.com/player_api";  var firstScriptTag = document.getElementsByTagName('script')[0];  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);  // Replace the 'ytplayer' element with an <iframe> and  // YouTube player after the API code downloads.  var player;  function onYouTubePlayerAPIReady() {    player = new YT.Player('ytplayer', {      height: '700',      width: '1600',      videoId: 'MyVideo',      playerVars: { 'autoplay': 1, 'controls': 0,'modestbranding': 1, 'rel': 0 }    });  }</script>

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>