Youtube iframe api onReady not firing on Ipad?

2019-07-22 20:39发布

问题:

I've read that you cannot autoplay videos, but I'm noticing that my onReady function is not being called on iPad. It works on all other browsers. Is this another know issues?

Here's my loading code:

player = new YT.Player('videoDiv', {
    events: {
        'onReady': onPlayerReady,
        'onStateChange': youtubePlayer.onPlayerStateChange
    }
});

onPlayerReady has an alert which does not show up on iPad, it does on all other broswers. Also it seems the player variable is not what I'm expecting. I get an [Object object] but doing player.playVideo or player.queVideoById() both cause errors. Are these also known bugs?

What does work on iPad?

Thanks!

回答1:

This is an old bug and it should be fixed at this time. The player variable that you're expecting will only have functions like playVideo and cueVideoById once the onReady event is called.