Suppose a player object has been defined from another javascript module youtube.js like below:
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('initial-video', {
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
How do I access this player from some_other_js_file.js so that I can load another video? Is it possible to define a new variable in some_other_js_file.js that points to the same player object? If it is not, what could be a possible workaround?