Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Youtube API v3 - Get "Live Now" rtmp and streamkey

Youtube now has a Live Streaming section that allows users to broadcast their own live stream sessions. In this "Live Streaming" section, there are 2 options: "Live Now [Beta]" and "Events".

  • Live Now is a fast and easy way to start a streaming session automatically just by pointing your video encoder to te specified RTMP Url and Stream Key. It will automatically detect incomming media and start broadcasting publicly.

  • Events is pretty much the same thing, but with advance settings, although it will not start automatically to broadcast, and you need to set everything pretty much manually.

I know Youtube API allows you to retrieve Event's ingestion url and streamkey, so you can broadcast to that target, but it also requires to manage many other steps manually (like publishing the stream, binding broadcasts with streams, check the status, start, stop, etc..). On the other hand "Live Now" makes everything automatically.

Question: How can I retrieve "Live Now" ingestion info (rtmp url and streamkey) from the Youtube API v3 ?

like image 562
omarojo Avatar asked Nov 19 '15 08:11

omarojo


People also ask

Does YouTube Live use RTMP?

RTMP is a widely-used protocol for video streaming that YouTube Live has accepted since the service began. RTMPS is a secure extension to RTMP. RTMPS benefits both content creators and viewers by preventing man-in-the-middle attacks on the ingestion side of livestreams.

How do I find my RTMP URL and stream key?

Select the Live Tools menu. Scroll to the bottom to find the RTMP Input option. Select Get Link. You will be presented with a Stream Key and a Server URL along with a few additional options.

How do I pull RTMP from YouTube?

Under “Stream settings,” in the "Stream URL" field, click the lock icon to show the RTMPS URL. Copy the Stream URL. Paste the URL into your encoder. Copy your YouTube stream key from Live Control Room and paste it into your encoder.

How do I find Streamkey on YouTube?

Under “Select stream key,” click Create new stream key. Enter your preferred settings and click Create. Your stream key will show up in the stream key list.


2 Answers

The default broadcast can be retrieved by livebroadcasts.list with broadcastType set to "persistent".

The default livestream can be retrieved by livestreams.list using boundstreamid.

like image 183
rhbc73 Avatar answered Sep 30 '22 00:09

rhbc73


You cannot retrieve "Live Now" ingestion info because the API does not differentiate between "Live Now" and "Events." Those two options are provided as interfaces on top of the API for an end user, so they don't have to write their own application that interfaces with the API.

You will have to manually set up liveBroadcast and liveStream objects, bind them with liveBroadcasts.bind, test your stream, and transition to live on the liveStream object using status.streamStatus.

like image 24
JAL Avatar answered Sep 30 '22 00:09

JAL