YouTube Setup¶
In This Section
Creating a YouTube Account¶
If you don’t already have a YouTube account, you’ll need to create one to develop with the Genvid SDK for the YouTube service.
The simplest way to create a new YouTube account is to visit YouTube and click the Sign In button in the top right corner. You’ll need to verify your account before creating your channel.
Warning
Do not attempt to continue with the rest of these steps before your account is verified.
Creating a YouTube Streaming Channel¶
After you create and verify your YouTube account, you need to activate your channel and enable it for live streaming.
- Go to your Live Dashboard.
- Fill in all the required information.
- Click Create in the upper-right corner.
- Select Go live.
- Click Get Started to enable live streaming.
Note
YouTube requires 24 hours to activate a new live account. Once activated, you will be able to start live streaming.
Configuring Live Streaming¶
Important
We’ve found that YouTube streams may fail after 8 hours of continuous streaming. We recommend you restart your YouTube stream every 8 hours to avoid this problem.
After activating the channel, you need to define a few parameters used for live streaming.
Go to YouTube.
Click Create in the upper right corner.
Select Go Live.
Select Later date.
Select Streaming software.
Click Stream in the left menu panel.
Enter your stream information in the necessary fields.
Important
If you want other people to see your streams, make sure you set your Privacy selection to Public. If you don’t, no one but you will be able to embed and use your YouTube live stream with the Genvid SDK.
Click Save.
In the STREAM SETTINGS section, copy these values to paste in your configuration file:
Stream URL Should be similar to
rtmp://a.rtmp.youtube.com/live2
.Stream Key Should be formatted like
xxxx-xxxx-xxxx-xxxx-xxxx
.Note
The Stream Key is the value that lets the Genvid SDK stream to YouTube.
Open your configuration file for editing.
Enter the Stream URL for the value of
settings.encode.stream.addr
.Enter the Stream Key for the value of
settings.encode.stream.key
.
See the Settings example below.
Optional Low Latency Option¶
YouTube allows to optimize the stream for either less viewer buffering (which is the default) or for lower latencies.
Should you prefer to lower the latency (our experience shows a latency of about 10-15 seconds), you can do so by selecting the Stream latency option of your choice in the STREAM SETTINGS (below the Stream key section).
Settings¶
Warning
The YouTube configuration now needs a Video ID
instead of a channel
name.
The YouTube configuration file requires the Video ID
and a Stream Key
.
To get your Video ID
:
Go to your YouTube channel home page.
Click
to open the YouTube studio tab.Copy your
Video ID
from the YouTube studio page’s URL.
https://studio.youtube.com/video/[YOUR VIDEO ID]/livestreaming
You can also get your Stream Key
from the same YouTube studio tab.
Once you have all the information above, you can edit your configuration file. The result should be set to the following:
version = "1.7.0"
settings {
encode {
stream {
enable = true
service = "youtube"
addr = "rtmp://a.rtmp.youtube.com/live2"
// YOU MUST CHANGE THE CHANNEL AND KEY VALUES
channel = ""
key = ""
}
}
leaf {
port = 30001
}
}
link "button" {
name = "Youtube Video"
template = "https://www.youtube.com/watch?v=${key `genvid/encode/stream/channel`}"
}
config {
embed_ssl {
enabled = false
}
} // end of config
If you want to stream using SSL, just make sure to set embed_ssl
to
true. Once you load your configuration file, a new button YOUTUBE CHANNEL
will appear that will redirect you to your stream on YouTube’s website. To test
the embedded stream on the website, click on CUBE SAMPLE
Warning
Whether you’re using SSL on a cloud or a local cluster, if you load
youtube.sample.hcl
before loading the web sample, the web sample
will overwrite the value associated with the embed_ssl
from the
web.hcl
file.