是否有人知道是否可以在2个不同的iframe上加载相同的YouTube视频而不加载两次?
我想要的是模仿Youtube iPhone应用程序。视频仍然在应用的右下方播放:
我做了什么:
<div id="youtube_iframe_big_player" data-youtube-id="youtubeId"></div>
<div id="youtube_iframe_reduced_player" data-youtube-id="youtubeId"></div>
<script>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('youtube_iframe_big_player', {
height: '390',
width: '640',
videoId: $("#youtube_iframe_big_player").attr("data-youtube-id"),
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
<script>
我已经尝试了下面的声音:
player = new YT.Player('youtube_iframe_big_player, youtube_iframe_reduced_player', {
...