How to embed a YouTube Live stream into your website
Here some tips are collected to embed your working YouTube Live stream into your own website.
To set up a 24/7 live-stream from your network camera with webcam.io, please start with live-streaming setup.
Requirements
The features Live-streaming and Embed livestreams need to be enabled in https://www.youtube.com/features. Please follow the instructions there.
If you have trouble getting the “Embed live streams” feature activated in YouTube, you might want to try Twitch for live-streaming instead. Please see How to stream your IP camera to Twitch
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 code
Open YouTube Studio
Open the stream from the “Manage Tab” on the left
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 an anonymous browser window to check if the stream shows up without errors.
Using a permanent URL
We recommend using a permanent URL, so link does not change if you need to recreate the stream.
However, this only works with the first stream in your account.
Get the Channel ID from https://www.youtube.com/account_advanced. Not the User ID!
Change the code to use the Channel ID (12345 here):
<iframe width="560" height="315" src="https://www.youtube.com/embed/live_stream?channel=12345" frameborder="0" allowfullscreen></iframe>
There is also a permanent link to your live stream:
https://www.youtube.com/channel/YOUR_CHANNEL_ID/live
Conclusion
This is an important part to set up your 24/7 live streaming camera with webcam.io, if you want to embed the stream into your website. The permanent URL is mandatory to keep links and embed codes unchanged.
Another important piece is to enable the backup stream feature of webcam.io, so a stream is still send to YouTube if your camera or connection breaks.
For more information, please refer to:
To try this feature for your own networked camera, sign up for our free 7-day trial.