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