如何控制youtube嵌入直播?

时间:2016-12-25 04:26:51

标签: html youtube embed live autoplay

我刚刚了解到YouTube直播网址随机更改。我在stackoverflow "YouTube Live Streaming embed code keeps changing"上找到了这个 所以我知道静态嵌入链接是https://www.youtube.com/embed/live_stream?channel=[channel ID]

我想知道的是如何将autoplay=1添加到嵌入链接以及此类任何其他功能。

30/7/2017更新 - 此方法无法在iPhone 6+上测试的ios V10.3.3上运行,播放器会破坏Safari和Chrome!

2 个答案:

答案 0 :(得分:1)

这很简单,只需在最后添加参数autoplay=1

https://www.youtube.com/embed/live_stream?channel=[channel ID]&autoplay=1

答案 1 :(得分:0)

允许自动播放并将其添加到嵌入式src的末尾。

 <iframe width="560" height="315" src="https://www.youtube.com/embed/ldy3VEPIRk0?autoplay=1" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>