How do I get the reference to an existing YouTube player?

后端 未结 5 724
忘掉有多难
忘掉有多难 2020-12-05 18:05

I have a few qu

5条回答
  •  盖世英雄少女心
    2020-12-05 18:33

    A great way to do this without loading the IFrame API in the parent window is to grab the object from the IFrame

    var ytplayer_window = document.getElementById("playerIFrame").contentWindow;
    var player = ytplayer_window.yt.player.getPlayerByElement(ytplayer_window.player);
    

提交回复
热议问题