프로그램/ASP · OS

유튜브 생방송 웹페이지에 코드로 넣기

늘맑은하늘 2018. 12. 21. 09:37

How to embed a YouTube Live stream into your website

This is a collection of tips to embed your working YouTube Live stream into your website:

Requirements

The features Live streaming and Embed live streams need to be enabled in https://www.youtube.com/features. Please follow the instructions there.

To embed into your website, a linked AdSense account seems to be required.

Also refer to:

Embed

  • Set the stream to unlisted or public
  • Go to the “Watch page” (View on watch page link (lower right) in https://www.youtube.com/live_dashboard)
  • Click Share -> Embed to get the embed HTML code

example:

<iframe width="560" height="315" src="https://www.youtube.com/embed/XYZ123" frameborder="0" 
allowfullscreen></iframe>

Now the problem is: every time the stream stops and restarts, the ID changes.

To get a permanent URL, you need to change the link to use the Channel ID (12345 in this example):

<iframe width="560" height="315" src=https://www.youtube.com/embed/live_stream?channel=12345 
frameborder="0" allowfullscreen></iframe>

Get the Channel ID from https://www.youtube.com/account_advanced. Not the User ID!

Add this into your website HTML, and open the website in anonymous browser window to check if the stream displays without error message.


출처 : https://webcam.io/blog/howto-embed-youtube-live.html



* 채널 아이디 구하기

https://www.youtube.com/account_advanced