Skip to content
webcam.io

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:

Update: If you have trouble getting the “Embed live streams” feature activated in YouTube, you can try Twitch for live streaming instead. Please see How to stream your IP camera to Twitch

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, stream privacy needs to be set to “unlisted” or “public” and a linked AdSense account seems to be required (?).

Embed

  1. Open YouTube Studio

  2. Open the stream from the “Manage Tab” on the left

  3. Click Share arrow in the upper right and select embed in the dialog footer to get the embed HTML code, example:

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

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

Permanent URL

If you only have one stream in your account, we recommend using a permanent URL, so link does not change if you need to recreate the stream.

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

  2. Change the code 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>

And, there is a permanent link to your live stream (always referencing the first stream in your channel): https://www.youtube.com/channel/YOUR_CHANNEL_ID/live

References