我有一个js函数,该函数从频道返回随机的VideoID。我想将此ID动态插入youtubeAPI的videoID参数中。
// 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
}
});
}
[Prueba utilizando esta linea :)