我有一个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利用esta linea:(
player.loadVideoById("id_video"(;