For Ad Manager integration, you need to create a live configuration for a given livestream event. The Video Stitcher API registers this config with Ad Manager.
Create a slate
Before you create the live configuration, you need to create a slate. The Video Stitcher API inserts a default slate video when ads can't be inserted. You must register slate video with the Video Stitcher API to indicate the slate to use in the absence of ads. The slate video can be any MP4 file with at least one audio track.
You have two options for creating this slate. You can create a default network slate in your Ad Manager account or you can create slates using the Video Stitcher API.
Create a slate in Ad Manager
To create a default network slate in your Ad Manager account, follow the steps at Create a slate to fill content gaps and then skip to section Create the live config.
Create a slate using the Video Stitcher API
To create a slate using the Video Stitcher API, use the
projects.locations.slates.create
method.
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 in which to create your slate; use one of the supported regionsShow locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
SLATE_ID
: a user-defined identifier for the slate. This ID can only contain lower-case letters, numbers, and hyphens. The first character must be a letter, the last character must be a letter or a number, and the entire ID has a 63 character maximum.SLATE_URL
: the public URI for an MP4 video with at least one audio track (sample video)NETWORK_CODE
: the numeric identifier for your Ad Manager network; you can find this in the Global settings for the publisher account
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/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime": CREATE_TIME, "target": "projects/PROJECT_NUMBER/locations/LOCATION/slates/SLATE_ID", "verb": "create" }, "done": false }
This command creates a
long-running operation (LRO)
that you can query to track progress. Copy the returned
OPERATION_ID
,
which is the last part of the name
field, to use in the next section.
Check for the result
Use the projects.locations.operations.get
method to check if the slate has been created. If the response contains
"done: false"
, repeat the command until the response contains "done: true"
.
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 of the data; use one of the supported regionsShow locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
OPERATION_ID
: the identifier for the operation
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/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime": CREATE_TIME, "endTime": END_TIME, "target": "projects/PROJECT_NUMBER/locations/LOCATION/slates/SLATE_ID", "verb": "create" }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.video.stitcher.v1.Slate", "name": "projects/PROJECT_NUMBER/locations/LOCATION/slates/SLATE_ID", "uri": "SLATE_URL", "gamSlate": { "networkCode": "NETWORK_CODE" "gamSlateId": "GAM_SLATE_ID" } } }
Create the live config
To create the config, use the
projects.locations.liveConfigs.create
method. See the
live config reference documentation
for optional fields (like
custom headers).
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 in which to create your live config; use one of the supported regionsShow locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
LIVE_CONFIG_ID
: a user-defined identifier for the live config. This ID can only contain lower-case letters, numbers, and hyphens. The first character must be a letter, the last character must be a letter or a number, and the entire ID has a 63 character maximum.SOURCE_LIVESTREAM_URI
: the source URL to the livestream video manifest. This must be accessible to the Video Stitcher API. The URL must either be publicly accessible or, if URL signing is enabled for the CDN, a registered CDN key has been provided to the Video Stitcher API. If you created a test livestream using the Live Stream API, then this is the URI to themain.m3u8
ormain.mpd
file in the Cloud Storage bucket. the URL for ad metadata retrieved from ad servers; for Ad Manager integration, this must be a valid Ad Manager live video ad tag. To get a valid ad tag, follow the steps on Generate video and audio ad tags with these modifications:AD_TAG_URI
- For Live traffic, enable live traffic.
- For the Player SDK type, select Google IMA SDK.
- Add the parameter
ad_rule=0
to the tag (for example, add&ad_rule=0
to the end).
SLATE_ID
: the ID of the slate to use in the absence of stitched adsNETWORK_CODE
: the numeric identifier for your Ad Manager network; you can find this in the Global settings for the publisher account.AD_TRACKING
: the ad tracking behavior for your stream. For IMA SDK integrations, useCLIENT
. For server-side ad tracking, useSERVER
. You may also override this value on a per-session basis later.
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/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.common.OperationMetadata", "createTime": CREATE_TIME, "target": "projects/PROJECT_NUMBER/locations/LOCATION/liveConfigs/LIVE_CONFIG_ID", "verb": "create" }, "done": false }
The Video Stitcher API asynchronously registers the config on your Ad Manager account. This may take a couple of minutes.
This command creates a long-running operation (LRO) that you can query to track progress. For more information, see Check for the result.
Get the config
To get the config, use the
projects.locations.liveConfigs.get
method.
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 of the live config; use one of the supported regionsShow locationsus-central1
us-east1
us-west1
asia-east1
asia-south1
asia-southeast1
europe-west1
southamerica-east1
LIVE_CONFIG_ID
: the user-defined identifier for the live config
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/liveConfigs/LIVE_CONFIG_ID", "sourceUri": "SOURCE_LIVESTREAM_URI", "adTagUri": "AD_TAG_URI", "gamLiveConfig": { "networkCode": "NETWORK_CODE", "assetKey": "ASSET_KEY", "customAssetKey": "PROJECT_NUMBER-LOCATION-LIVE_CONFIG_ID" }, "state": "READY", "adTracking": "CLIENT", "defaultSlate": "projects/PROJECT_NUMBER/locations/LOCATION/slates/SLATE_ID", "stitchingPolicy": "CUT_CURRENT" }
Find the customAssetKey
field and copy the returned
CUSTOM_ASSET_KEY. You send
these values to the Interactive Media Ads (IMA) SDK in a subsequent step.