huggie
huggie

Reputation: 18237

YouTube streaming

In YouTube streaming API we can create a broadcast and stream, but how do I actually start streaming?

I mean, when we create a broadcast with the browser, we have to click the "preview button" first. And when YouTube receives streaming content, then we can click on the "broadcast button".

What is the equivalent API call for this? Pointing to either Java, Python, or PHP API is fine for me, thanks.

Upvotes: 1

Views: 1084

Answers (2)

Leandro Carracedo
Leandro Carracedo

Reputation: 7345

As the documentation for live broadcast transition states:

Changes the status of a YouTube live broadcast and initiates any processes associated with the new status. For example, when you transition a broadcast's status to testing, YouTube starts to transmit video to that broadcast's monitor stream. Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active.

The broadcastStatus parameter identifies the state to which the broadcast is changing. Note that to transition a broadcast to either the testing or live state, the status.streamStatus must be active for the stream that the broadcast is bound to.

Acceptable values for the broadcastStatus parameter are:

  • complete – The broadcast is over. YouTube stops transmitting video.
  • live – The broadcast is visible to its audience. YouTube transmits video to the broadcast's monitor stream and its broadcast stream.
  • testing – Start testing the broadcast. YouTube transmits video to the broadcast's monitor stream. Note that you can only transition a broadcast to the testing state if its contentDetails.monitorStream.enableMonitorStream property is set to true.

Upvotes: 1

Pepijn
Pepijn

Reputation: 332

POST https://www.googleapis.com/youtube/v3/liveBroadcasts/transition

When setting broadcastStatus to live you're going live. When setting it to testing YouTube only transmits video to the broadcast's monitor stream.

More info here https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/transition

Upvotes: 1

Related Questions