Load same youtube video on 2 diffrent iframes with

2019-07-29 18:31发布

问题:

Does anyone know if it's possible to load same youtube video on 2 diffrent iframes without loading it twice ?

What I want is to imitate Youtube iPhone App. The video is still playing at the bottom right of the app :

What I did :

<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>

I already tried the bellow :

player = new YT.Player('youtube_iframe_big_player, youtube_iframe_reduced_player', {
...