This page shows you how to create and manage Live Stream API channel events. A channel event is a sub-resource of a channel. You can use a channel event to execute operations on a channel resource without needing to stop the channel.
Set up your Google Cloud project and authentication
If you have not created a Google Cloud project and credentials, see Before you begin.Prerequisites
You must create the following resources before creating a channel event:
Create a channel event
Make sure to start the channel before creating a channel event.
To create a channel event, use the
projects.locations.channels.events.create
method. The following event types are supported:
- Ad break event
- Insert slate event
- Return to program event
- Mute event
- Unmute event
- Switch input event
Events can be executed immediately or scheduled to run in the future.
The Live Stream API automatically deletes a channel event seven days after the event is executed. This deletion includes events that have failed.
Ad break event
Use the adBreak
object to insert a new ad opportunity.
Use the Return to program event to return from the ad break back to the live stream.
REST
Before using any of the request data, make the following replacements:
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pageLOCATION
: the location where your channel is located; use one of the supported regionsShow locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-northeast1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west3
europe-west4
CHANNEL_ID
: a user-defined identifier for the channelEVENT_ID
: a user-defined identifier for the event
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/channels/CHANNEL_ID/events/EVENT_ID", "createTime": CREATE_TIME, "updateTime": UPDATE_TIME, "adBreak": { "duration": "100s" }, "executeNow": true, "state": "PENDING" }
C#
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API C# API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Go API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Java API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Node.js API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PHP
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API PHP API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Python API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Ruby API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Insert slate event
Use the slate
object to
insert a slate into a live stream.
Before using any of the request data, make the following replacements:
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pageLOCATION
: the location where your channel is located; use one of the supported regionsShow locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-northeast1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west3
europe-west4
CHANNEL_ID
: a user-defined identifier for the channelEVENT_ID
: a user-defined identifier for the eventASSET_ID
: the user-defined identifier for the slate asset
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/channels/CHANNEL_ID/events/EVENT_ID", "createTime": CREATE_TIME, "updateTime": UPDATE_TIME, "slate": { "duration": "60s", "asset": "projects/PROJECT_NUMBER/locations/LOCATION/assets/ASSET_ID" }, "executeNow": "true", "state": "PENDING" }
Return to program event
Use the returnToProgram
object to stop all running adBreak
events. You can stop these events
immediately or schedule the stop for a future time using the
executionTime
field.
Before using any of the request data, make the following replacements:
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pageLOCATION
: the location where your channel is located; use one of the supported regionsShow locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-northeast1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west3
europe-west4
CHANNEL_ID
: a user-defined identifier for the channelEVENT_ID
: a user-defined identifier for the event
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/channels/CHANNEL_ID/events/EVENT_ID", "createTime": CREATE_TIME, "updateTime": UPDATE_TIME, "executeNow": true, "state": "PENDING", "returnToProgram": {} }
Mute event
Use the mute
object to mute the live stream. You can specify a duration for which the stream
should be muted, or mute the stream until an unmute event is
executed.
Before using any of the request data, make the following replacements:
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pageLOCATION
: the location where your channel is located; use one of the supported regionsShow locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-northeast1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west3
europe-west4
CHANNEL_ID
: a user-defined identifier for the channelEVENT_ID
: a user-defined identifier for the event
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/channels/CHANNEL_ID/events/EVENT_ID", "createTime": CREATE_TIME, "updateTime": UPDATE_TIME, "mute": { "duration": "30s" }, "executeNow": true, "state": "PENDING" }
Unmute event
Use the unmute
object to unmute (that is, restore sound to) the live stream.
Before using any of the request data, make the following replacements:
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pageLOCATION
: the location where your channel is located; use one of the supported regionsShow locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-northeast1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west3
europe-west4
CHANNEL_ID
: a user-defined identifier for the channelEVENT_ID
: a user-defined identifier for the event
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/channels/CHANNEL_ID/events/EVENT_ID", "createTime": CREATE_TIME, "updateTime": UPDATE_TIME, "unmute": {}, "executeNow": true, "state": "PENDING" }
Switch input event
Use the inputSwitch
object to manually switch the channel input. See
Create a channel with a backup input stream
for more information on creating a channel with additional inputs.
When you manually switch the input, the
InputSwitchMode
changes to MANUAL
. The designated input stream is then always used, even if a
backup input stream is configured by the automaticFailover
field of the designated input stream. The channel won't switch to the backup
input stream when the designated input stream disconnects because automatic
failover is disabled. To enable failover again, see
Enable automatic failover.
Before using any of the request data, make the following replacements:
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pageLOCATION
: the location where your channel is located; use one of the supported regionsShow locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-northeast1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west3
europe-west4
CHANNEL_ID
: a user-defined identifier for the channelEVENT_ID
: a user-defined identifier for the event
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/channels/CHANNEL_ID/events/EVENT_ID", "createTime": CREATE_TIME, "updateTime": UPDATE_TIME, "inputSwitch": { "inputKey": "input-backup" }, "executeNow": true, "state": "PENDING" }
Enable automatic failover
To enable automatic failover after a manual input switch, do the following:
- Stop the channel
- Update the
InputSwitchMode
channel field toFAILOVER_PREFER_PRIMARY
- Start the channel
Get channel event details
To get the details of a channel event, use the
projects.locations.channels.events.get
method.
REST
Before using any of the request data, make the following replacements:
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pageLOCATION
: the location where your channel is located; use one of the supported regionsShow locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-northeast1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west3
europe-west4
CHANNEL_ID
: a user-defined identifier for the channelEVENT_ID
: a user-defined identifier for the event
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/channels/CHANNEL_ID/events/EVENT_ID", "createTime": CREATE_TIME, "updateTime": UPDATE_TIME, "adBreak": { "duration": "10s" }, "executeNow": true, "state": "SCHEDULED" }
C#
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API C# API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Go API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Java API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Node.js API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PHP
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API PHP API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Python API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Ruby API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
List channel events
To list all of the channel events you created for a channel, use the
projects.locations.channels.events.list
method.
REST
Before using any of the request data, make the following replacements:
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pageLOCATION
: the location where your channel is located; use one of the supported regionsShow locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-northeast1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west3
europe-west4
CHANNEL_ID
: a user-defined identifier for the channel
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "events": [ { "name": "projects/PROJECT_NUMBER/locations/LOCATION/channels/CHANNEL_ID/events/my-event", "createTime": CREATE_TIME, "updateTime": UPDATE_TIME, "adBreak": { "duration": "10s" }, "executeNow": true, "state": "SCHEDULED" }, { "name": "projects/PROJECT_NUMBER/locations/LOCATION/channels/CHANNEL_ID/events/my-event2", "createTime": CREATE_TIME, "updateTime": UPDATE_TIME, "adBreak": { "duration": "10s" }, "executeNow": true, "state": "SCHEDULED" } ] }
C#
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API C# API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Go API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Java API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Node.js API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PHP
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API PHP API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Python API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Ruby API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Delete a channel event
To delete a channel event, use the
projects.locations.channels.events.delete
method.
The Live Stream API automatically deletes a channel event seven days after the event is executed. This deletion includes events that have failed.
REST
Before using any of the request data, make the following replacements:
PROJECT_NUMBER
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pageLOCATION
: the location where your channel is located; use one of the supported regionsShow locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-northeast1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west3
europe-west4
CHANNEL_ID
: a user-defined identifier for the channelEVENT_ID
: a user-defined identifier for the event
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{}
C#
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API C# API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Go API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Java API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Node.js API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PHP
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API PHP API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Python API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Ruby API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.