YouTube Setup
Creating a YouTube Account
If you don’t already have a YouTube account, you’ll need to create one to develop with the Genvid MILE 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
YouTube scheduled streams have a maximum duration of 8 hours. Unscheduled streams as described in this page have a maximum duration of 12 hours.
We recommend you restart your stream every 8 hours to avoid YouTube automatically ending it.
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.
Enter your stream information in the YouTube Studio webpage.
See the YouTube documentation for more information.
Important
For the web SDK to provide access to the stream for viewers, the Privacy selection must be either set to Public or Unlisted. By selecting Private, only you will be able to access your YouTube live stream with the Genvid MILE 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 MILE 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 lets you define the offset between when YouTube receives the stream encoded by the Genvid MILE SDK and when the viewers can actually watch it. You can set it by by selecting the Stream latency option in the STREAM SETTINGS (below the Stream key section).
For an optimal interactive experience, we recommend using Ultra low latency.
Important
Depending on your selection, you must ensure your maximum data cache setting is set to an equal or higher value than the stream latency.
For example, with Low-latency our experience shows a latency of about 10-15 seconds. Therefore, the maximum data cache must be higher than 15 seconds. With Ultra low-latency we see a latency of about 5-10 seconds, so the maximum data cache must be higher than 10 seconds.
See dataStreams.maximumDataCacheAge in The Genvid Settings for more information.
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.