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

Youtube API: See which video id is currently playing

$
0
0

Is there a way to display/see/return which video (so, which videoID) is playing at the moment?

This is the basic code of the Iframe API:

var player;  function onYouTubeIframeAPIReady() {    player = new YT.Player('player', {      height: '390',      width: '640',      videoId: 'pJ18QeQy0e8',      events: {'onReady': onPlayerReady,'onStateChange': onPlayerStateChange,'onError': onError,      },        playerVars: {'controls': 0,'showinfo': 0,'iv_load_policy': 3,'wmode': "opaque",                },    });  }

after the first video has finished. This event will be called:

  function onPlayerStateChange(event) {if(event.data === 0) {            player.stopVideo();player.loadVideoById(getId());                  }  }

The getId() function will get another videoId to play..

I want to display in a DIV, which videoId is currently playing


Viewing all articles
Browse latest Browse all 3831

Trending Articles



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