且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

***的iFrame Api直播视频?

更新时间:2023-02-21 07:58:05

我遇到了同样的问题.我发现您可以直接使用src而不是空div添加iframe.然后给它一个id并将其传递给新的YT.Player实例.

I came across this same issue. I figured out that you can directly add the iframe with the src instead of an empty div. Then give it an id and pass that to the new YT.Player instance.

例如:的HTML:< iframe id ="player" src ="https://www.***.com/embed/live_stream?channel=CHANNEL_ID?enablejsapi=1"></iframe>

js: var player = new YT.Player('player',{});