使用频道ID嵌入YouTube直播

时间:2018-12-03 14:18:58

标签: c# asp.net youtube live-streaming

我将asp.net与C#一起使用,并且需要一个页面来显示来自我的youtube频道的实时流。

我想使用频道ID永久嵌入YouTube直播。我正在按照本教程https://webcam.io/blog/howto-embed-youtube-live.html进行操作,但不幸的是它没有用。

<div style="position:relative;height:0;padding-bottom:56.25%"><iframe src="https://www.youtube.com/embed/AYR_9fRDa8s?ecver=2" style="position:absolute;width:100%;height:100%;left:0" width="640" height="360" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>

当我从YouTube复制嵌入代码时,它会为我提供这些信息,当创建新的实时视频时,这些信息会改变。

如果您知道如何将其与频道ID关联,请帮助我。

谢谢

1 个答案:

答案 0 :(得分:1)

此公式对我有用:

<iframe type="text/html" width="854" height="480" src="https://www.youtube.com/embed/live_stream?channel=[CHANNEL_ID]&autoplay=1"></iframe>
相关问题