LiveStreams

A liveStream resource contains information about the video stream that you are transmitting to YouTube. The stream provides the content that will be broadcast to YouTube users. Once created, a liveStream resource can be bound to one or more liveBroadcast resources.

Methods

The API supports the following methods for liveStreams resources:

list
Returns a list of video streams that match the API request parameters. Try it now.
insert
Creates a video stream. The stream enables you to send your video to YouTube, which can then broadcast the video to your audience. Try it now.
update
Updates a video stream. If the properties that you want to change cannot be updated, then you need to create a new stream with the proper settings. Try it now.
delete
Deletes a video stream. Try it now.

Resource representation

The following JSON structure shows the format of a liveStreams resource:

{
  "kind": "youtube#liveStream",
  "etag": etag,
  "id": string,
  "snippet": {
    "publishedAt": datetime,
    "channelId": string,
    "title": string,
    "description": string,
    "isDefaultStream": boolean
  },
  "cdn": {
    "format": string,
    "ingestionType": string,
    "ingestionInfo": {
      "streamName": string,
      "ingestionAddress": string,
      "backupIngestionAddress": string
    },
    "resolution": string,
    "frameRate": string
  },
  "status": {
    "streamStatus": string,
    "healthStatus": {
      "status": string,
      "lastUpdateTimeSeconds": unsigned long,
      "configurationIssues": [
        {
          "type": string,
          "severity": string,
          "reason": string,
          "description": string
        }
      ]
    }
  },
  "contentDetails": {
    "closedCaptionsIngestionUrl": string,
    "isReusable": boolean
  }
}

Properties

The following table defines the properties that appear in this resource:

Properties
kind string
Identifies the API resource's type. The value will be youtube#liveStream.
etag etag
The Etag of this resource.
id string
The ID that YouTube assigns to uniquely identify the stream.
snippet object
The snippet object contains basic details about the stream, including its channel, title, and description.
snippet.publishedAt datetime
The date and time that the stream was created. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
snippet.channelId string
The ID that YouTube uses to uniquely identify the channel that is transmitting the stream.
snippet.title string
The stream's title. The value must be between 1 and 128 characters long.
snippet.description string
The stream's description. The value cannot be longer than 10000 characters.
snippet.isDefaultStream boolean
Indicates whether this stream is the default stream for the channel.

How default streams work

When a YouTube channel is enabled for live streaming, YouTube creates a default stream and a default broadcast for the channel. The stream defines how the channel owner sends live video to YouTube, and the broadcast is how viewers can see the default stream. A channel owner can use the liveStreams.list and liveBroadcasts.list methods to identify these resources.

A channel's default stream exists indefinitely, does not have a start or end time associated with it, and cannot be deleted. The channel owner needs only to start sending video bits and the stream goes on automatically.

When a stream ends, YouTube converts the completed broadcast to a YouTube video and assigns the video a YouTube video ID. After the conversion is complete, the video is included in the channel's list of uploaded videos. The video is not available immediately after the broadcast concludes, and the length of the delay is related to the actual length of the broadcast.
cdn object
The cdn object defines the live stream's content delivery network (CDN) settings. These settings provide details about the manner in which you stream your content to YouTube.
cdn.format string
This property has been deprecated as of April 18, 2016. Instead, please use the cdn.frameRate and cdn.resolution properties to specify the frame rate and resolution separately.

The format of the video stream that you are sending to Youtube.

Valid values for this property are:
  • 1440p_hfr: This value is for 60 frames per second (fps), or high-frame-rate, streams.
  • 1440p
  • 1080p_hfr: This value is for 60 frames per second (fps), or high-frame-rate, streams.
  • 1080p
  • 720p_hfr: This value is for 60 frames per second (fps), or high-frame-rate, streams.
  • 720p
  • 480p
  • 360p
  • 240p
cdn.ingestionType string
The method or protocol used to transmit the video stream.

Valid values for this property are:
  • dash
  • rtmp
cdn.ingestionInfo object
The ingestionInfo object contains information that YouTube provides that you need to transmit your stream to YouTube.
cdn.ingestionInfo.streamName string
The stream name that YouTube assigns to the video stream.
cdn.ingestionInfo.ingestionAddress string
The primary ingestion URL that you should use to stream video to YouTube. You must stream video to this URL.

Depending on which application or tool you use to encode your video stream, you may need to enter the stream URL and stream name separately or you may need to concatenate them in the following format:
STREAM_URL/STREAM_NAME
cdn.ingestionInfo.backupIngestionAddress string
The backup ingestion URL that you should use to stream video to YouTube. You have the option of simultaneously streaming the content that you are sending to the ingestionAddress to this URL.
cdn.resolution string
The resolution of the inbound video data.

Valid values for this property are:
  • 240p
  • 360p
  • 480p
  • 720p
  • 1080p
  • 1440p
  • 2160p
cdn.frameRate string
The frame rate of the inbound video data.

Valid values for this property are:
  • 30fps
  • 60fps
status object
The status object contains information about live stream's status.
status.streamStatus string
The stream's status.

Valid values for this property are:
  • active – The stream is in active state which means the user is receiving data via the stream.
  • created – The stream has been created but does not have valid CDN settings.
  • error – An error condition exists on the stream.
  • inactive – The stream is in inactive state which means the user is not receiving data via the stream.
  • ready – The stream has valid CDN settings.
status.healthStatus object
This object contains information about the live stream's health status, which could be used to identify, diagnose, and resolve streaming problems.
status.healthStatus.status string
The status code of this stream.

Valid values for this property are:
  • good – There are no configuration issues for which the severity is warning or worse.
  • ok – There are no configuration issues for which the severity is error.
  • bad – The stream has some issues for which the severity is error.
  • noData – YouTube's live streaming backend servers do not have any information about the stream's health status.
status.healthStatus.lastUpdateTimeSeconds unsigned long
The last time that the stream's health status was updated. The value reflects a UNIX timestamp in seconds.
status.healthStatus.configurationIssues[] list
This object contains a list of configuration issues affecting the stream.
status.healthStatus.configurationIssues[].type string
Identifies the type of error affecting the stream.
status.healthStatus.configurationIssues[].severity string
Indicates how severe the issue is to the stream.

Valid values for this property are:
  • info – The video is broadcast to viewers with no adverse effect on performance.
  • warning – The video is broadcast to viewers, but performance is not optimal.
  • error – The video cannot be broadcast to viewers.
status.healthStatus.configurationIssues[].reason string
A short description of the issue. The Configuration Issues for LiveStream Resources document identifies the reason associated with each configuration issue type.
status.healthStatus.configurationIssues[].description string
A detailed description of the issue. When possible, the description provides information about how to resolve the issue. The Configuration Issues for LiveStream Resources document lists all of the configuration issue types and their associated descriptions.
contentDetails object
The content_details object contains information about the stream, including the closed captions ingestion URL.
contentDetails.closedCaptionsIngestionUrl string
The ingestion URL where the closed captions of this stream are sent.
contentDetails.isReusable boolean
Indicates whether the stream is reusable, which means that it can be bound to multiple broadcasts. It is common for broadcasters to reuse the same stream for many different broadcasts if those broadcasts occur at different times.

If you set this value to false, then the stream will not be reusable, which means that it can only be bound to one broadcast. Non-reusable streams differ from reusable streams in the following ways:
  • A non-reusable stream can only be bound to one broadcast.
  • A non-reusable stream might be deleted by an automated process after the broadcast ends.
  • The liveStreams.list method does not list non-reusable streams if you call the method and set the mine parameter to true. The only way to use that method to retrieve the resource for a non-reusable stream is to use the id parameter to identify the stream.