To enable the Video Stitcher API for your project, please reach out to your Account Representative or contact Sales to learn more.

Inspect a VOD session

The Video Stitcher API inserts ads into video assets. The adTagUri field in the body of a VOD session request specifies the URL from where ad metadata is retrieved. The Video Stitcher API also includes user metadata when it makes the request.

The /vodAdTagDetails endpoint contains the following information:

  • resolved ad tag
  • user metadata
  • request body and headers
  • response body and headers

The /vodStitchDetails endpoint contains the following information:

  • ad break ID
  • ad ID
  • ad time offset (in seconds)
  • reason if the ad was not inserted
  • ad media metadata

This document describes how to inspect the ad tag details and stitch details for a given VOD session. For more details, see the REST documentation for VodAdTagDetail and VodStitchDetail.

Before you begin

Make sure that you're familiar with the steps to create a VOD session.

Suppose that you create a VOD session and receive the following session (some fields omitted):

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION/vodSessions/SESSION_ID"
  ...
}

This page assumes the VOD session, as shown above, has already been created.

List ad tag details

To list the ad tag details for a VOD session, use the projects.locations.vodSessions.vodAdTagDetails.list method.

REST

Before using any of the request data, make the following replacements:

  • PROJECT_NUMBER: your Google Cloud project number located in the Project number field on the IAM Settings page
  • LOCATION: the location of your session; use one of the supported regions:
    • us-central1
    • us-east1
    • us-west1
    • asia-east1
    • asia-south1
    • asia-southeast1
    • europe-west1
    • southamerica-east1
  • SESSION_ID: the session ID for the VOD session

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "vodAdTagDetails" : [
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION/vodSessions/SESSION_ID/vodAdTagDetails/VOD_AD_TAG_DETAILS_ID",
      "adRequests": [
        {
          "uri": "REQUEST_URL",
          "requestMetadata": "AD_TAG_REQUEST_METADATA",
          "responseMetadata": "AD_TAG_RESPONSE_METADATA"
        }
      ]
    }
  ]
}

Python

Before trying this sample, follow the Python setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Python API reference documentation.

To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.


import argparse

from google.cloud.video.stitcher_v1.services.video_stitcher_service import (
    VideoStitcherServiceClient,
)


def list_vod_ad_tag_details(project_id: str, location: str, session_id: str) -> str:
    """Lists the ad tag details for the specified VOD session.
    Args:
        project_id: The GCP project ID.
        location: The location of the session.
        session_id: The ID of the VOD session."""

    client = VideoStitcherServiceClient()

    parent = client.vod_session_path(project_id, location, session_id)
    page_result = client.list_vod_ad_tag_details(parent=parent)
    print("VOD ad tag details:")
    for response in page_result:
        print(response)

    return response

The response returns a list of VodAdTagDetail objects. Each VodAdTagDetail represents the ad retrieval metadata for an ad tag, and each AdRequest represents the ad request metadata for a single ad request.

Additional results

The curl response may include a nextPageToken, which you can use to retrieve additional results:

{
  "vodAdTagDetails": [
    ...
  ],
  "nextPageToken": "NEXT_PAGE_TOKEN"
}

You can send another curl request, including the value of NEXT_PAGE_TOKEN, to list the additional objects. Append the following to the URL in the preceding API call:

?pageToken=NEXT_PAGE_TOKEN

Get ad tag details

To get the details for a single VodAdTagDetail object in a VOD session, use the projects.locations.vodSessions.vodAdTagDetails.get method.

REST

Before using any of the request data, make the following replacements:

  • PROJECT_NUMBER: your Google Cloud project number located in the Project number field on the IAM Settings page
  • LOCATION: the location of your session; use one of the supported regions:
    • us-central1
    • us-east1
    • us-west1
    • asia-east1
    • asia-south1
    • asia-southeast1
    • europe-west1
    • southamerica-east1
  • SESSION_ID: the session ID for the VOD session
  • VOD_AD_TAG_DETAILS_ID: the ID for the VOD ad tag details

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/vodSessions/SESSION_ID/vodAdTagDetails/VOD_AD_TAG_DETAILS_ID",
  "adRequests": [
    {
      "uri": "REQUEST_URL",
      "requestMetadata": "AD_TAG_REQUEST_METADATA",
      "responseMetadata": "AD_TAG_RESPONSE_METADATA"
    }
  ]
}

Python

Before trying this sample, follow the Python setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Python API reference documentation.

To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.


import argparse

from google.cloud.video.stitcher_v1.services.video_stitcher_service import (
    VideoStitcherServiceClient,
)


def get_vod_ad_tag_detail(
    project_id: str, location: str, session_id: str, ad_tag_detail_id: str
) -> str:
    """Gets the specified ad tag detail for a VOD session.
    Args:
        project_id: The GCP project ID.
        location: The location of the session.
        session_id: The ID of the VOD session.
        ad_tag_detail_id: The ID of the ad tag details."""

    client = VideoStitcherServiceClient()

    name = client.vod_ad_tag_detail_path(
        project_id, location, session_id, ad_tag_detail_id
    )
    response = client.get_vod_ad_tag_detail(name=name)
    print(f"VOD ad tag detail: {response.name}")
    return response

List stitch details

You can view detailed information about the ads that were stitched for any VOD session.

To list the stitch details for a VOD session, use the projects.locations.vodSessions.vodStitchDetails.list method.

REST

Before using any of the request data, make the following replacements:

  • PROJECT_NUMBER: your Google Cloud project number located in the Project number field on the IAM Settings page
  • LOCATION: the location of your session; use one of the supported regions:
    • us-central1
    • us-east1
    • us-west1
    • asia-east1
    • asia-south1
    • asia-southeast1
    • europe-west1
    • southamerica-east1
  • SESSION_ID: the session ID for the VOD session

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "vodStitchDetails" : [
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION/vodSessions/SESSION_ID/vodStitchDetails/VOD_STITCH_DETAIL_ID",
      "adStitchDetails": [
        {
          "adBreakId": "AD_BREAK_ID",
          "adId": "AD_ID",
          "adTimeOffset": "AD_TIME_OFFSET",
          "skipReason": "SKIP_REASON",
          "media": "MEDIA_OBJECT"
        },
        {
          "adBreakId": "my-other-ad-break-id",
          "adId": "my-other-ad-id",
          "adTimeOffset": "my-other-ad-time-offset",
          "skipReason": "my-other-skip-reason",
          "media": "my-other-media-object"
        }
      ]
    }
  ]
}

Python

Before trying this sample, follow the Python setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Python API reference documentation.

To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.


import argparse

from google.cloud.video.stitcher_v1.services.video_stitcher_service import (
    VideoStitcherServiceClient,
)


def list_vod_stitch_details(project_id: str, location: str, session_id: str) -> str:
    """Lists the stitch details for the specified VOD session.
    Args:
        project_id: The GCP project ID.
        location: The location of the session.
        session_id: The ID of the VOD session."""

    client = VideoStitcherServiceClient()

    parent = client.vod_session_path(project_id, location, session_id)
    page_result = client.list_vod_stitch_details(parent=parent)
    print("VOD stitch details:")
    for response in page_result:
        print(response)

    return response

The response returns a list of VodStitchDetail objects. Each VodStitchDetail represents the stitch detail for an ad tag, and each adStitchDetails object represents the stitch detail for a single ad.

This response may include a nextPageToken, which you can use to retrieve additional results:

{
  "vodStitchDetails": [
    ...
  ],
  "nextPageToken": "NEXT_PAGE_TOKEN"
}

You can then send another request, including the value of NEXT_PAGE_TOKEN, to list the additional stitch detail objects. Append the following to the URL in the preceding API call:

?pageToken=NEXT_PAGE_TOKEN

Get ad tag stitch detail

To get the stitch detail for a single ad tag for a VOD session, use the projects.locations.vodSessions.vodStitchDetails.get method.

REST

Before using any of the request data, make the following replacements:

  • PROJECT_NUMBER: your Google Cloud project number located in the Project number field on the IAM Settings page
  • LOCATION: the location of your session; use one of the supported regions:
    • us-central1
    • us-east1
    • us-west1
    • asia-east1
    • asia-south1
    • asia-southeast1
    • europe-west1
    • southamerica-east1
  • SESSION_ID: the session ID for the VOD session
  • VOD_STITCH_DETAILS_ID: the ID for the VOD stitch details

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/vodSessions/SESSION_ID/vodStitchDetails/VOD_STITCH_DETAIL_ID",
  "adStitchDetails": [
    {
      "adBreakId": "AD_BREAK_ID",
      "adId": "AD_ID",
      "adTimeOffset": "AD_TIME_OFFSET",
      "skipReason": "SKIP_REASON",
      "media": "MEDIA_OBJECT"
    }
  ]
}

Python

Before trying this sample, follow the Python setup instructions in the Video Stitcher API quickstart using client libraries. For more information, see the Video Stitcher API Python API reference documentation.

To authenticate to Video Stitcher API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.


import argparse

from google.cloud.video.stitcher_v1.services.video_stitcher_service import (
    VideoStitcherServiceClient,
)


def get_vod_stitch_detail(
    project_id: str, location: str, session_id: str, stitch_detail_id: str
) -> str:
    """Gets the specified stitch detail for a VOD session.
    Args:
        project_id: The GCP project ID.
        location: The location of the session.
        session_id: The ID of the VOD session.
        stitch_detail_id: The ID of the stitch details."""

    client = VideoStitcherServiceClient()

    name = client.vod_stitch_detail_path(
        project_id, location, session_id, stitch_detail_id
    )
    response = client.get_vod_stitch_detail(name=name)
    print(f"VOD stitch detail: {response.name}")
    return response