YouTube player iframe API: playVideo doesn't work on Firefox 9.0.1

后端 未结 4 1826
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-15 18:16

I\'ve got some YouTube embedding code (I will paste only code which is causing the trouble for me and cut things which are not public):

console.log(ytplayer);
yt         


        
4条回答
  •  长情又很酷
    2021-02-15 18:39

    I came across this post looking for something similar. I found my answer here, by relic180:

    YouTube API - Firefox/IE return error "X is not a function" for any 'player.' request

    Basically, Chrome can initialize youtube embeds even when the divs are hidden (i.e. display:none), but FF and IE can't. My solution was a variant of relic180's:

    I move my player to left:200% or whatever when I want it invisible but getting initialized (and available for other calls to player), then move it back on screen when I need it.

提交回复
热议问题