Reputation: 1
I have a js function that returns a random VideoID from a channel. I want to dynamically insert this ID into the youtubeAPI's videoID parameter.
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: <<INSERT RETURN OF FUNCTION HERE>>
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
Upvotes: 0
Views: 558