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
.
Common use cases
Request
HTTP request
POST https://www.googleapis.com/youtube/v3/liveBroadcasts/transition
Authorization
This request requires authorization with at least one of the following scopes. To read more about authentication and authorization, see Implementing OAuth 2.0 authentication .
Scope |
---|
https://www.googleapis.com/auth/youtube
|
https://www.googleapis.com/auth/youtube.force-ssl
|
Parameters
The following table lists the parameters that this query supports. All of the parameters listed are query parameters.
broadcastStatus
string
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 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 thetesting
state if itscontentDetails.monitorStream.enableMonitorStream
property is set totrue
.
id
string
The
id
parameter specifies the unique ID of the broadcast that is transitioning to another status.part
string
The
part
parameter specifies a comma-separated list of one or more liveBroadcast
resource properties that the API response will include. The part
names that you can include in the parameter value are id
, snippet
, contentDetails
, and status
.onBehalfOfContentOwner
string
This parameter can only be used in a properly authorized request .
Note:This parameter is intended exclusively for YouTube content partners.
The
onBehalfOfContentOwner
parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.onBehalfOfContentOwnerChannel
string
This parameter can only be used in a properly authorized request .
Note:This parameter is intended exclusively for YouTube content partners.
The
onBehalfOfContentOwnerChannel
parameter specifies the YouTube channel ID of the channel to which a video is being added. This parameter is required when a request specifies a value for the onBehalfOfContentOwner
parameter, and it can only be used in conjunction with that parameter. In addition, the request must be authorized using a CMS account that is linked to the content owner that the onBehalfOfContentOwner
parameter specifies. Finally, the channel that the onBehalfOfContentOwnerChannel
parameter value specifies must be linked to the content owner that the onBehalfOfContentOwner
parameter specifies.This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel.
Request body
Do not provide a request body when calling this method.
Response
If successful, this method returns a liveBroadcast resource in the response body.
Errors
The following table identifies error messages that the API could return in response to a call to this method. For more details, see YouTube Live Streaming API - Errors .
Error type | Error detail | Description |
---|---|---|
backendError
|
errorExecutingTransition
|
An error occurred while changing the broadcast's status. |
forbidden (403)
|
errorStreamInactive
|
The requested transition is not allowed when the stream that is bound to the broadcast is inactive. |
forbidden (403)
|
invalidTransition
|
The live broadcast can't transition from its current status to the requested status. |
forbidden (403)
|
redundantTransition
|
The live broadcast is already in the requested status or processing to the requested status. |
insufficientPermissions
|
insufficientLivePermissions
|
The request is not authorized to transition the live broadcast. |
insufficientPermissions
|
livePermissionBlocked
|
The user that authorized the request is unable to stream live video on YouTube at this time. For details explaining why the user cannot stream a live video, see the user's channel settings at Feature eligibility . |
insufficientPermissions
|
liveStreamingNotEnabled
|
The user that authorized the request is not enabled to stream live video on YouTube. For more information, see Feature eligibility . |
notFound (404)
|
liveBroadcastNotFound
|
The broadcast specified by the id
parameter does not exist. |
rateLimitExceeded (403)
|
userRequestsExceedRateLimit
|
The user has sent too many requests in a given timeframe. |
required (400)
|
idRequired
|
The required id
parameter must identify the broadcast whose status you want to transition. |
required (400)
|
statusRequired
|
The API request must specify a value for the status
parameter. |
Try it!
Use the APIs Explorer to call this API and see the API request and response.