Create and manage a live config

This document describes how to manage live configs. Live configs are used to configure live sessions . For more details, see the REST documentation .

Before you begin

To create a live session, you must first configure a livestream encoder which generates a source HLS or DASH manifest for the Video Stitcher API. These manifests contain certain ad markers at ad break boundaries which are identified by the Video Stitcher API for ad stitching purposes. You can create a livestream with a compatible manifest by following one of the Live Stream API quickstarts .

For more details on the supported HLS and DASH ad markers, see the ad markers documentation .

Define a live config

When you define a live config, the following fields are required:

  • sourceUri
  • adTagUri
  • defaultSlate
  • adTracking

sourceUri specifies the URL to the source livestream's HLS or DASH manifest to insert ads into. The Video Stitcher API returns an HLS playback URL if the provided URL references an HLS manifest and a DASH playback URL if the provided URL references a DASH manifest.

adTagUri specifies the URL of the ad server that returns the ad metadata.

defaultSlate specifies the default slate to use when no slates are specified in an ad break's ad marker SCTE-35 message. For details about managing slates, see the slates documentation .

adTracking determines if the client player is expected to trigger playback and activity events or if the Video Stitcher API is expected to trigger playback events on behalf of the client player. For more information on client-side ad tracking, see Handle client-side ad tracking .

The live config contains optional fields for prefetching ads and defining custom headers .

Register a live config

To register a live config, use the projects.locations.liveConfigs.create 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 page
  • LOCATION : the location in which to create your live config; use one of the supported regions
    Show locations
    • us-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 URI of the livestream manifest; use a public URI or an unsigned URI for which you registered a CDN key
  •  AD_TAG_URI 
    
    the public URI for the default ad tag. If you don't have one, you can use a Single Inline Linear sample.
  • SLATE_ID : the ID of the slate to use in the absence of stitched ads

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",
    "cancelRequested": false,
    "apiVersion": "v1"
  },
  "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.

C#

Before trying this sample, follow the C# setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API C# 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 .

  using 
  
  Google.Api.Gax.ResourceNames 
 
 ; 
 using 
  
  Google.Cloud.Video.Stitcher.V1 
 
 ; 
 using 
  
  Google.LongRunning 
 
 ; 
 using 
  
 System.Threading.Tasks 
 ; 
 public 
  
 class 
  
 CreateLiveConfigSample 
 { 
  
 public 
  
 async 
  
 Task<LiveConfig> 
  
 CreateLiveConfigAsync 
 ( 
  
 string 
  
 projectId 
 , 
  
 string 
  
 location 
 , 
  
 string 
  
 liveConfigId 
 , 
  
 string 
  
 sourceUri 
 , 
  
 string 
  
 adTagUri 
 , 
  
 string 
  
 slateId 
 ) 
  
 { 
  
 // Create the client. 
  
  VideoStitcherServiceClient 
 
  
 client 
  
 = 
  
  VideoStitcherServiceClient 
 
 . 
  Create 
 
 (); 
  
  CreateLiveConfigRequest 
 
  
 request 
  
 = 
  
 new 
  
  CreateLiveConfigRequest 
 
  
 { 
  
 ParentAsLocationName 
  
 = 
  
  LocationName 
 
 . 
  FromProjectLocation 
 
 ( 
 projectId 
 , 
  
 location 
 ), 
  
 LiveConfigId 
  
 = 
  
 liveConfigId 
 , 
  
 LiveConfig 
  
 = 
  
 new 
  
  LiveConfig 
 
  
 { 
  
 SourceUri 
  
 = 
  
 sourceUri 
 , 
  
 AdTagUri 
  
 = 
  
 adTagUri 
 , 
  
 DefaultSlate 
  
 = 
  
  SlateName 
 
 . 
  FormatProjectLocationSlate 
 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 slateId 
 ), 
  
 AdTracking 
  
 = 
  
  AdTracking 
 
 . 
  Server 
 
 , 
  
 StitchingPolicy 
  
 = 
  
  LiveConfig 
 
 . 
  Types 
 
 . 
  StitchingPolicy 
 
 . 
  CutCurrent 
 
  
 } 
  
 }; 
  
 // Make the request. 
  
 Operation<LiveConfig 
 , 
  
 OperationMetadata 
>  
 response 
  
 = 
  
 await 
  
 client 
 . 
  CreateLiveConfigAsync 
 
 ( 
 request 
 ); 
  
 // Poll until the returned long-running operation is complete. 
  
 Operation<LiveConfig 
 , 
  
 OperationMetadata 
>  
 completedResponse 
  
 = 
  
 await 
  
 response 
 . 
 PollUntilCompletedAsync 
 (); 
  
 // Retrieve the operation result. 
  
 return 
  
 completedResponse 
 . 
 Result 
 ; 
  
 } 
 } 
 

Go

Before trying this sample, follow the Go setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Go 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 
  
 ( 
  
 "context" 
  
 "fmt" 
  
 "io" 
  
 stitcher 
  
 "cloud.google.com/go/video/stitcher/apiv1" 
  
 stitcherstreampb 
  
 "cloud.google.com/go/video/stitcher/apiv1/stitcherpb" 
 ) 
 // createLiveConfig creates a live config. Live configs are used to configure live sessions. 
 func 
  
 createLiveConfig 
 ( 
 w 
  
 io 
 . 
 Writer 
 , 
  
 projectID 
 , 
  
 liveConfigID 
 , 
  
 sourceURI 
 , 
  
 slateID 
  
 string 
 ) 
  
 error 
  
 { 
  
 // projectID := "my-project-id" 
  
 // liveConfigID := "my-live-config-id" 
  
 // Uri of the media to stitch; this URI must reference either an MPEG-DASH 
  
 // manifest (.mpd) file or an M3U playlist manifest (.m3u8) file. 
  
 // sourceURI := "https://storage.googleapis.com/my-bucket/main.mpd" 
  
 // See https://cloud.google.com/video-stitcher/docs/concepts for information 
  
 // on ad tags and ad metadata. This sample uses an ad tag URL that displays 
  
 // a Single Inline Linear ad 
  
 // (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags). 
  
 adTagURI 
  
 := 
  
 "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=" 
  
 // slateID := "my-slate-id" 
  
 location 
  
 := 
  
 "us-central1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 client 
 , 
  
 err 
  
 := 
  
 stitcher 
 . 
  NewVideoStitcherClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 fmt 
 . 
 Errorf 
 ( 
 "stitcher.NewVideoStitcherClient: %w" 
 , 
  
 err 
 ) 
  
 } 
  
 defer 
  
 client 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& stitcherstreampb 
 . 
 CreateLiveConfigRequest 
 { 
  
 Parent 
 : 
  
 fmt 
 . 
 Sprintf 
 ( 
 "projects/%s/locations/%s" 
 , 
  
 projectID 
 , 
  
 location 
 ), 
  
 LiveConfigId 
 : 
  
 liveConfigID 
 , 
  
 LiveConfig 
 : 
  
& stitcherstreampb 
 . 
 LiveConfig 
 { 
  
 SourceUri 
 : 
  
 sourceURI 
 , 
  
 AdTagUri 
 : 
  
 adTagURI 
 , 
  
 AdTracking 
 : 
  
 stitcherstreampb 
 . 
 AdTracking_SERVER 
 , 
  
 StitchingPolicy 
 : 
  
 stitcherstreampb 
 . 
 LiveConfig_CUT_CURRENT 
 , 
  
 DefaultSlate 
 : 
  
 fmt 
 . 
 Sprintf 
 ( 
 "projects/%s/locations/%s/slates/%s" 
 , 
  
 projectID 
 , 
  
 location 
 , 
  
 slateID 
 ), 
  
 }, 
  
 } 
  
 // Creates the live config. 
  
 op 
 , 
  
 err 
  
 := 
  
 client 
 . 
 CreateLiveConfig 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 fmt 
 . 
 Errorf 
 ( 
 "client.createLiveConfig: %w" 
 , 
  
 err 
 ) 
  
 } 
  
 response 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 err 
  
 } 
  
 fmt 
 . 
 Fprintf 
 ( 
 w 
 , 
  
 "Live config: %v" 
 , 
  
 response 
 . 
 GetName 
 ()) 
  
 return 
  
 nil 
 } 
 

Java

Before trying this sample, follow the Java setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Java 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 
  
 com.google.cloud.video.stitcher.v1. AdTracking 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. CreateLiveConfigRequest 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. LiveConfig 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. LiveConfig 
. StitchingPolicy 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. LocationName 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. SlateName 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. VideoStitcherServiceClient 
 
 ; 
 import 
  
 java.io.IOException 
 ; 
 import 
  
 java.util.concurrent.ExecutionException 
 ; 
 import 
  
 java.util.concurrent.TimeUnit 
 ; 
 import 
  
 java.util.concurrent.TimeoutException 
 ; 
 public 
  
 class 
 CreateLiveConfig 
  
 { 
  
 private 
  
 static 
  
 final 
  
 int 
  
 TIMEOUT_IN_MINUTES 
  
 = 
  
 2 
 ; 
  
 public 
  
 static 
  
 void 
  
 main 
 ( 
 String 
 [] 
  
 args 
 ) 
  
 throws 
  
 Exception 
  
 { 
  
 // TODO(developer): Replace these variables before running the sample. 
  
 String 
  
 projectId 
  
 = 
  
 "my-project-id" 
 ; 
  
 String 
  
 location 
  
 = 
  
 "us-central1" 
 ; 
  
 String 
  
 liveConfigId 
  
 = 
  
 "my-live-config-id" 
 ; 
  
 // Uri of the live stream to stitch; this URI must reference either an MPEG-DASH 
  
 // manifest (.mpd) file or an M3U playlist manifest (.m3u8) file. 
  
 String 
  
 sourceUri 
  
 = 
  
 "https://storage.googleapis.com/my-bucket/main.mpd" 
 ; 
  
 // See Single Inline Linear 
  
 // (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags) 
  
 String 
  
 adTagUri 
  
 = 
  
 "https://pubads.g.doubleclick.net/gampad/ads..." 
 ; 
  
 String 
  
 slateId 
  
 = 
  
 "my-slate-id" 
 ; 
  
 createLiveConfig 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 liveConfigId 
 , 
  
 sourceUri 
 , 
  
 adTagUri 
 , 
  
 slateId 
 ); 
  
 } 
  
 // Creates a live config. Live configs are used to configure live sessions. 
  
 // For more information, see 
  
 // https://cloud.google.com/video-stitcher/docs/how-to/managing-live-configs. 
  
 public 
  
 static 
  
  LiveConfig 
 
  
 createLiveConfig 
 ( 
  
 String 
  
 projectId 
 , 
  
 String 
  
 location 
 , 
  
 String 
  
 liveConfigId 
 , 
  
 String 
  
 sourceUri 
 , 
  
 String 
  
 adTagUri 
 , 
  
 String 
  
 slateId 
 ) 
  
 throws 
  
 IOException 
 , 
  
 ExecutionException 
 , 
  
 InterruptedException 
 , 
  
 TimeoutException 
  
 { 
  
 // Initialize client that will be used to send requests. This client only needs to be created 
  
 // once, and can be reused for multiple requests. 
  
 try 
  
 ( 
  VideoStitcherServiceClient 
 
  
 videoStitcherServiceClient 
  
 = 
  
  VideoStitcherServiceClient 
 
 . 
 create 
 ()) 
  
 { 
  
  CreateLiveConfigRequest 
 
  
 createLiveConfigRequest 
  
 = 
  
  CreateLiveConfigRequest 
 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
  LocationName 
 
 . 
 of 
 ( 
 projectId 
 , 
  
 location 
 ). 
 toString 
 ()) 
  
 . 
  setLiveConfigId 
 
 ( 
 liveConfigId 
 ) 
  
 . 
 setLiveConfig 
 ( 
  
  LiveConfig 
 
 . 
 newBuilder 
 () 
  
 . 
 setSourceUri 
 ( 
 sourceUri 
 ) 
  
 . 
 setAdTagUri 
 ( 
 adTagUri 
 ) 
  
 . 
  setDefaultSlate 
 
 ( 
  SlateName 
 
 . 
 format 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 slateId 
 )) 
  
 . 
 setAdTracking 
 ( 
  AdTracking 
 
 . 
 SERVER 
 ) 
  
 . 
  setStitchingPolicy 
 
 ( 
  StitchingPolicy 
 
 . 
 CUT_CURRENT 
 ) 
  
 . 
 build 
 ()) 
  
 . 
 build 
 (); 
  
  LiveConfig 
 
  
 response 
  
 = 
  
 videoStitcherServiceClient 
  
 . 
  createLiveConfigAsync 
 
 ( 
 createLiveConfigRequest 
 ) 
  
 . 
 get 
 ( 
 TIMEOUT_IN_MINUTES 
 , 
  
 TimeUnit 
 . 
 MINUTES 
 ); 
  
 System 
 . 
 out 
 . 
 println 
 ( 
 "Created new live config: " 
  
 + 
  
 response 
 . 
  getName 
 
 ()); 
  
 return 
  
 response 
 ; 
  
 } 
  
 } 
 } 
 

Node.js

Before trying this sample, follow the Node.js setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Node.js 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 .

  /** 
 * TODO(developer): Uncomment these variables before running the sample. 
 */ 
 // projectId = 'my-project-id'; 
 // location = 'us-central1'; 
 // liveConfigId = 'my-live-config-id'; 
 // sourceUri = 'https://storage.googleapis.com/my-bucket/main.mpd'; 
 // See Single Inline Linear 
 // (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags) 
 // adTagUri = 'https://pubads.g.doubleclick.net/gampad/ads...'; 
 // slateId = 'my-slate'; 
 // Imports the Video Stitcher library 
 const 
  
 { 
 VideoStitcherServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/video-stitcher 
' 
 ). 
 v1 
 ; 
 // Instantiates a client 
 const 
  
 stitcherClient 
  
 = 
  
 new 
  
  VideoStitcherServiceClient 
 
 (); 
 async 
  
 function 
  
 createLiveConfig 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 parent 
 : 
  
 stitcherClient 
 . 
  locationPath 
 
 ( 
 projectId 
 , 
  
 location 
 ), 
  
 liveConfig 
 : 
  
 { 
  
 sourceUri 
 : 
  
 sourceUri 
 , 
  
 adTagUri 
 : 
  
 adTagUri 
 , 
  
 adTracking 
 : 
  
 ' SERVER 
' 
 , 
  
 stitchingPolicy 
 : 
  
 ' CUT_CURRENT 
' 
 , 
  
 defaultSlate 
 : 
  
 stitcherClient 
 . 
  slatePath 
 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 slateId 
 ), 
  
 }, 
  
 liveConfigId 
 : 
  
 liveConfigId 
 , 
  
 }; 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 stitcherClient 
 . 
 createLiveConfig 
 ( 
 request 
 ); 
  
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 `response.name: 
 ${ 
 response 
 . 
 name 
 } 
 ` 
 ); 
 } 
 createLiveConfig 
 (). 
 catch 
 ( 
 err 
  
 = 
>  
 { 
  
 console 
 . 
 error 
 ( 
 err 
 . 
 message 
 ); 
  
 process 
 . 
 exitCode 
  
 = 
  
 1 
 ; 
 }); 
 

PHP

Before trying this sample, follow the PHP setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API PHP 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 .

  use Google\Cloud\Video\Stitcher\V1\AdTracking; 
 use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient; 
 use Google\Cloud\Video\Stitcher\V1\CreateLiveConfigRequest; 
 use Google\Cloud\Video\Stitcher\V1\LiveConfig; 
 /** 
 * Creates a live config. Live configs are used to configure live sessions. 
 * 
 * @param string $callingProjectId     The project ID to run the API call under 
 * @param string $location             The location of the live config 
 * @param string $liveConfigId         The name of the live config to be created 
 * @param string $sourceUri            Uri of the media to stitch; this URI must 
 *                                     reference either an MPEG-DASH manifest 
 *                                     (.mpd) file or an M3U playlist manifest 
 *                                     (.m3u8) file. 
 * @param string $adTagUri             The Uri of the ad tag 
 * @param string $slateId              The user-defined slate ID of the default 
 *                                     slate to use when no slates are specified 
 *                                     in an ad break's message 
 */ 
 function create_live_config( 
 string $callingProjectId, 
 string $location, 
 string $liveConfigId, 
 string $sourceUri, 
 string $adTagUri, 
 string $slateId 
 ): void { 
 // Instantiate a client. 
 $stitcherClient = new VideoStitcherServiceClient(); 
 $parent = $stitcherClient->locationName($callingProjectId, $location); 
 $defaultSlate = $stitcherClient->slateName($callingProjectId, $location, $slateId); 
 $liveConfig = (new LiveConfig()) 
 ->setSourceUri($sourceUri) 
 ->setAdTagUri($adTagUri) 
 ->setAdTracking(AdTracking::SERVER) 
 ->setStitchingPolicy(LiveConfig\StitchingPolicy::CUT_CURRENT) 
 ->setDefaultSlate($defaultSlate); 
 // Run live config creation request 
 $request = (new CreateLiveConfigRequest()) 
 ->setParent($parent) 
 ->setLiveConfigId($liveConfigId) 
 ->setLiveConfig($liveConfig); 
 $operationResponse = $stitcherClient->createLiveConfig($request); 
 $operationResponse->pollUntilComplete(); 
 if ($operationResponse->operationSucceeded()) { 
 $result = $operationResponse->getResult(); 
 // Print results 
 printf('Live config: %s' . PHP_EOL, $result->getName()); 
 } else { 
 $error = $operationResponse->getError(); 
 // handleError($error) 
 } 
 } 
 

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 
  
 import 
  stitcher_v1 
 
 from 
  
 google.cloud.video.stitcher_v1.services.video_stitcher_service 
  
 import 
 ( 
  VideoStitcherServiceClient 
 
 , 
 ) 
 def 
  
 create_live_config 
 ( 
 project_id 
 : 
 str 
 , 
 location 
 : 
 str 
 , 
 live_config_id 
 : 
 str 
 , 
 live_stream_uri 
 : 
 str 
 , 
 ad_tag_uri 
 : 
 str 
 , 
 slate_id 
 : 
 str 
 , 
 ) 
 - 
> stitcher_v1 
 . 
 types 
 . 
 LiveConfig 
 : 
  
 """Creates a live config. 
 Args: 
 project_id: The GCP project ID. 
 location: The location in which to create the live config. 
 live_config_id: The user-defined live config ID. 
 live_stream_uri: Uri of the livestream to stitch; this URI must reference either an MPEG-DASH 
 manifest (.mpd) file or an M3U playlist manifest (.m3u8) file. 
 ad_tag_uri: Uri of the ad tag. 
 slate_id: The user-defined slate ID of the default slate to use when no slates are specified in an ad break's message. 
 Returns: 
 The live config resource. 
 """ 
 client 
 = 
 VideoStitcherServiceClient 
 () 
 parent 
 = 
 f 
 "projects/ 
 { 
 project_id 
 } 
 /locations/ 
 { 
 location 
 } 
 " 
 default_slate 
 = 
 f 
 "projects/ 
 { 
 project_id 
 } 
 /locations/ 
 { 
 location 
 } 
 /slates/ 
 { 
 slate_id 
 } 
 " 
 live_config 
 = 
  stitcher_v1 
 
 . 
  types 
 
 . 
  LiveConfig 
 
 ( 
 source_uri 
 = 
 live_stream_uri 
 , 
 ad_tag_uri 
 = 
 ad_tag_uri 
 , 
 ad_tracking 
 = 
 "SERVER" 
 , 
 stitching_policy 
 = 
 "CUT_CURRENT" 
 , 
 default_slate 
 = 
 default_slate 
 , 
 ) 
 operation 
 = 
 client 
 . 
  create_live_config 
 
 ( 
 parent 
 = 
 parent 
 , 
 live_config_id 
 = 
 live_config_id 
 , 
 live_config 
 = 
 live_config 
 ) 
 response 
 = 
 operation 
 . 
 result 
 () 
 print 
 ( 
 f 
 "Live config: 
 { 
 response 
 . 
 name 
 } 
 " 
 ) 
 return 
 response 
 

Ruby

Before trying this sample, follow the Ruby setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Ruby 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 .

  require 
  
 "google/cloud/video/stitcher" 
 ## 
 # Create a live config 
 # 
 # @param project_id [String] Your Google Cloud project (e.g. `my-project`) 
 # @param location [String] The location (e.g. `us-central1`) 
 # @param live_config_id [String] Your live config name (e.g. `my-live-config`) 
 # @param source_uri [String] Uri of the live stream to stitch 
 #   (e.g. `https://storage.googleapis.com/my-bucket/main.mpd`) 
 # @param ad_tag_uri [String] Uri of the ad tag 
 #   (e.g. `https://pubads.g.doubleclick.net/gampad/ads...`) 
 # @param slate_id [String] The default slate ID to use when no slates are 
 #   specified in an ad break's message (e.g. `my-slate-id`) 
 # 
 def 
  
 create_live_config 
  
 project_id 
 :, 
  
 location 
 :, 
  
 live_config_id 
 :, 
  
 source_uri 
 :, 
  
 ad_tag_uri 
 :, 
  
 slate_id 
 : 
  
 # Create a Video Stitcher client. 
  
 client 
  
 = 
  
 Google 
 :: 
 Cloud 
 :: 
 Video 
 :: 
 Stitcher 
 . 
 video_stitcher_service 
  
 # Build the resource name of the parent. 
  
 parent 
  
 = 
  
 client 
 . 
 location_path 
  
 project 
 : 
  
 project_id 
 , 
  
 location 
 : 
  
 location 
  
 # Build the resource name of the default slate. 
  
 slate_name 
  
 = 
  
 client 
 . 
 slate_path 
  
 project 
 : 
  
 project_id 
 , 
  
 location 
 : 
  
 location 
 , 
  
 slate 
 : 
  
 slate_id 
  
 # Set the live config fields. 
  
 new_live_config 
  
 = 
  
 { 
  
 source_uri 
 : 
  
 source_uri 
 , 
  
 ad_tag_uri 
 : 
  
 ad_tag_uri 
 , 
  
 ad_tracking 
 : 
  
 Google 
 :: 
 Cloud 
 :: 
 Video 
 :: 
 Stitcher 
 :: 
 V1 
 :: 
 AdTracking 
 :: 
 SERVER 
 , 
  
 stitching_policy 
 : 
  
 Google 
 :: 
 Cloud 
 :: 
 Video 
 :: 
 Stitcher 
 :: 
 V1 
 :: 
 LiveConfig 
 :: 
 StitchingPolicy 
 :: 
 CUT_CURRENT 
 , 
  
 default_slate 
 : 
  
 slate_name 
  
 } 
  
 operation 
  
 = 
  
 client 
 . 
 create_live_config 
  
 parent 
 : 
  
 parent 
 , 
  
 live_config_id 
 : 
  
 live_config_id 
 , 
  
 live_config 
 : 
  
 new_live_config 
  
 # The returned object is of type Gapic::Operation. You can use this 
  
 # object to check the status of an operation, cancel it, or wait 
  
 # for results. Here is how to block until completion: 
  
 operation 
 . 
 wait_until_done! 
  
 # Print the live config name. 
  
 puts 
  
 "Live config: 
 #{ 
 operation 
 . 
 response 
 . 
 name 
 } 
 " 
 end 
 

Check for the result

To check if the live config has been created, use the projects.locations.operations.get method. 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 page
  • LOCATION : the location of the data; use one of the supported regions
    Show locations
    • us-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 
/liveConfigs/ LIVE_CONFIG_ID 
",
    "verb": "create",
    "cancelRequested": false,
    "apiVersion": "v1"
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.video.stitcher.v1.LiveConfig",
    "name": "projects/ PROJECT_NUMBER 
/locations/ LOCATION 
/liveConfigs/ LIVE_CONFIG_ID 
",
    "sourceUri": " SOURCE_LIVESTREAM_URI 
",
    "adTagUri": " AD_TAG_URI 
",
    "state": "READY",
    "adTracking": "CLIENT",
    "defaultSlate": "projects/ PROJECT_NUMBER 
/locations/ LOCATION 
/slates/ SLATE_ID 
",
    "stitchingPolicy": "CUT_CURRENT",
    "defaultAdBreakDuration": "30s"
  }
}

Get a live config

To get the details for a specific live config, use the projects.locations.liveConfigs.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 page
  • LOCATION : the location of the live config; use one of the supported regions
    Show locations
    • us-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 
",
  "state": "READY",
  "adTracking": "SERVER",
  "defaultSlate": "projects/ PROJECT_NUMBER 
/locations/ LOCATION 
/slates/ SLATE_ID 
",
  "stitchingPolicy": "CUT_CURRENT"
}

C#

Before trying this sample, follow the C# setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API C# 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 .

  using 
  
  Google.Cloud.Video.Stitcher.V1 
 
 ; 
 public 
  
 class 
  
 GetLiveConfigSample 
 { 
  
 public 
  
 LiveConfig 
  
 GetLiveConfig 
 ( 
  
 string 
  
 projectId 
 , 
  
 string 
  
 location 
 , 
  
 string 
  
 liveConfigId 
 ) 
  
 { 
  
 // Create the client. 
  
  VideoStitcherServiceClient 
 
  
 client 
  
 = 
  
  VideoStitcherServiceClient 
 
 . 
  Create 
 
 (); 
  
  GetLiveConfigRequest 
 
  
 request 
  
 = 
  
 new 
  
  GetLiveConfigRequest 
 
  
 { 
  
 LiveConfigName 
  
 = 
  
  LiveConfigName 
 
 . 
  FromProjectLocationLiveConfig 
 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 liveConfigId 
 ) 
  
 }; 
  
 // Call the API. 
  
  LiveConfig 
 
  
 response 
  
 = 
  
 client 
 . 
  GetLiveConfig 
 
 ( 
 request 
 ); 
  
 // Return the result. 
  
 return 
  
 response 
 ; 
  
 } 
 } 
 

Go

Before trying this sample, follow the Go setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Go 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 
  
 ( 
  
 "context" 
  
 "encoding/json" 
  
 "fmt" 
  
 "io" 
  
 stitcher 
  
 "cloud.google.com/go/video/stitcher/apiv1" 
  
 stitcherstreampb 
  
 "cloud.google.com/go/video/stitcher/apiv1/stitcherpb" 
 ) 
 // getLiveConfig gets a previously-created live config. 
 func 
  
 getLiveConfig 
 ( 
 w 
  
 io 
 . 
 Writer 
 , 
  
 projectID 
 , 
  
 liveConfigID 
  
 string 
 ) 
  
 error 
  
 { 
  
 // projectID := "my-project-id" 
  
 // liveConfigID := "my-live-config-id" 
  
 location 
  
 := 
  
 "us-central1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 client 
 , 
  
 err 
  
 := 
  
 stitcher 
 . 
  NewVideoStitcherClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 fmt 
 . 
 Errorf 
 ( 
 "stitcher.NewVideoStitcherClient: %w" 
 , 
  
 err 
 ) 
  
 } 
  
 defer 
  
 client 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& stitcherstreampb 
 . 
 GetLiveConfigRequest 
 { 
  
 Name 
 : 
  
 fmt 
 . 
 Sprintf 
 ( 
 "projects/%s/locations/%s/liveConfigs/%s" 
 , 
  
 projectID 
 , 
  
 location 
 , 
  
 liveConfigID 
 ), 
  
 } 
  
 response 
 , 
  
 err 
  
 := 
  
 client 
 . 
 GetLiveConfig 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 fmt 
 . 
 Errorf 
 ( 
 "client.GetLiveConfig: %w" 
 , 
  
 err 
 ) 
  
 } 
  
 b 
 , 
  
 err 
  
 := 
  
 json 
 . 
 MarshalIndent 
 ( 
 response 
 , 
  
 "" 
 , 
  
 " " 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 fmt 
 . 
 Errorf 
 ( 
 "json.MarshalIndent: %w" 
 , 
  
 err 
 ) 
  
 } 
  
 fmt 
 . 
 Fprintf 
 ( 
 w 
 , 
  
 "Live config:\n%s" 
 , 
  
 string 
 ( 
 b 
 )) 
  
 return 
  
 nil 
 } 
 

Java

Before trying this sample, follow the Java setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Java 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 
  
 com.google.cloud.video.stitcher.v1. GetLiveConfigRequest 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. LiveConfig 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. LiveConfigName 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. VideoStitcherServiceClient 
 
 ; 
 import 
  
 java.io.IOException 
 ; 
 public 
  
 class 
 GetLiveConfig 
  
 { 
  
 public 
  
 static 
  
 void 
  
 main 
 ( 
 String 
 [] 
  
 args 
 ) 
  
 throws 
  
 Exception 
  
 { 
  
 // TODO(developer): Replace these variables before running the sample. 
  
 String 
  
 projectId 
  
 = 
  
 "my-project-id" 
 ; 
  
 String 
  
 location 
  
 = 
  
 "us-central1" 
 ; 
  
 String 
  
 liveConfigId 
  
 = 
  
 "my-live-config-id" 
 ; 
  
 getLiveConfig 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 liveConfigId 
 ); 
  
 } 
  
 // Gets a live config. 
  
 public 
  
 static 
  
  LiveConfig 
 
  
 getLiveConfig 
 ( 
 String 
  
 projectId 
 , 
  
 String 
  
 location 
 , 
  
 String 
  
 liveConfigId 
 ) 
  
 throws 
  
 IOException 
  
 { 
  
 // Initialize client that will be used to send requests. This client only needs to be created 
  
 // once, and can be reused for multiple requests. 
  
 try 
  
 ( 
  VideoStitcherServiceClient 
 
  
 videoStitcherServiceClient 
  
 = 
  
  VideoStitcherServiceClient 
 
 . 
 create 
 ()) 
  
 { 
  
  GetLiveConfigRequest 
 
  
 getLiveConfigRequest 
  
 = 
  
  GetLiveConfigRequest 
 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
  LiveConfigName 
 
 . 
 of 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 liveConfigId 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
  LiveConfig 
 
  
 response 
  
 = 
  
 videoStitcherServiceClient 
 . 
 getLiveConfig 
 ( 
 getLiveConfigRequest 
 ); 
  
 System 
 . 
 out 
 . 
 println 
 ( 
 "Live config: " 
  
 + 
  
 response 
 . 
  getName 
 
 ()); 
  
 return 
  
 response 
 ; 
  
 } 
  
 } 
 } 
 

Node.js

Before trying this sample, follow the Node.js setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Node.js 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 .

  /** 
 * TODO(developer): Uncomment these variables before running the sample. 
 */ 
 // projectId = 'my-project-id'; 
 // location = 'us-central1'; 
 // liveConfigId = 'my-live-config-id'; 
 // Imports the Video Stitcher library 
 const 
  
 { 
 VideoStitcherServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/video-stitcher 
' 
 ). 
 v1 
 ; 
 // Instantiates a client 
 const 
  
 stitcherClient 
  
 = 
  
 new 
  
  VideoStitcherServiceClient 
 
 (); 
 async 
  
 function 
  
 getLiveConfig 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 : 
  
 stitcherClient 
 . 
  liveConfigPath 
 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 liveConfigId 
 ), 
  
 }; 
  
 const 
  
 [ 
 liveConfig 
 ] 
  
 = 
  
 await 
  
 stitcherClient 
 . 
 getLiveConfig 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 `Live config: 
 ${ 
 liveConfig 
 . 
 name 
 } 
 ` 
 ); 
 } 
 getLiveConfig 
 (). 
 catch 
 ( 
 err 
  
 = 
>  
 { 
  
 console 
 . 
 error 
 ( 
 err 
 . 
 message 
 ); 
  
 process 
 . 
 exitCode 
  
 = 
  
 1 
 ; 
 }); 
 

PHP

Before trying this sample, follow the PHP setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API PHP 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 .

  use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient; 
 use Google\Cloud\Video\Stitcher\V1\GetLiveConfigRequest; 
 /** 
 * Gets a live config. 
 * 
 * @param string $callingProjectId     The project ID to run the API call under 
 * @param string $location             The location of the live config 
 * @param string $liveConfigId         The ID of the live config 
 */ 
 function get_live_config( 
 string $callingProjectId, 
 string $location, 
 string $liveConfigId 
 ): void { 
 // Instantiate a client. 
 $stitcherClient = new VideoStitcherServiceClient(); 
 $formattedName = $stitcherClient->liveConfigName($callingProjectId, $location, $liveConfigId); 
 $request = (new GetLiveConfigRequest()) 
 ->setName($formattedName); 
 $liveConfig = $stitcherClient->getLiveConfig($request); 
 // Print results 
 printf('Live config: %s' . PHP_EOL, $liveConfig->getName()); 
 } 
 

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 
  
 import 
 stitcher_v1 
 from 
  
 google.cloud.video.stitcher_v1.services.video_stitcher_service 
  
 import 
 ( 
 VideoStitcherServiceClient 
 , 
 ) 
 def 
  
 get_live_config 
 ( 
 project_id 
 : 
 str 
 , 
 location 
 : 
 str 
 , 
 live_config_id 
 : 
 str 
 ) 
 - 
> stitcher_v1 
 . 
 types 
 . 
 LiveConfig 
 : 
  
 """Gets a live config. 
 Args: 
 project_id: The GCP project ID. 
 location: The location of the live config. 
 live_config_id: The user-defined live config ID. 
 Returns: 
 The live config resource. 
 """ 
 client 
 = 
 VideoStitcherServiceClient 
 () 
 name 
 = 
 f 
 "projects/ 
 { 
 project_id 
 } 
 /locations/ 
 { 
 location 
 } 
 /liveConfigs/ 
 { 
 live_config_id 
 } 
 " 
 response 
 = 
 client 
 . 
 get_live_config 
 ( 
 name 
 = 
 name 
 ) 
 print 
 ( 
 f 
 "Live config: 
 { 
 response 
 . 
 name 
 } 
 " 
 ) 
 return 
 response 
 

Ruby

Before trying this sample, follow the Ruby setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Ruby 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 .

  require 
  
 "google/cloud/video/stitcher" 
 ## 
 # Get a live config 
 # 
 # @param project_id [String] Your Google Cloud project (e.g. `my-project`) 
 # @param location [String] The location (e.g. `us-central1`) 
 # @param live_config_id [String] Your live config name (e.g. `my-live-config`) 
 # 
 def 
  
 get_live_config 
  
 project_id 
 :, 
  
 location 
 :, 
  
 live_config_id 
 : 
  
 # Create a Video Stitcher client. 
  
 client 
  
 = 
  
 Google 
 :: 
 Cloud 
 :: 
 Video 
 :: 
 Stitcher 
 . 
 video_stitcher_service 
  
 # Build the resource name of the live config. 
  
 name 
  
 = 
  
 client 
 . 
 live_config_path 
  
 project 
 : 
  
 project_id 
 , 
  
 location 
 : 
  
 location 
 , 
  
 live_config 
 : 
  
 live_config_id 
  
 # Get the live config. 
  
 live_config 
  
 = 
  
 client 
 . 
 get_live_config 
  
 name 
 : 
  
 name 
  
 # Print the live config name. 
  
 puts 
  
 "Live config: 
 #{ 
 live_config 
 . 
 name 
 } 
 " 
 end 
 

Update a live config

To update a specific live config, use the projects.locations.liveConfigs.patch method. You can only update the custom headers .

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 page
  • LOCATION : the location in which to create your live config; use one of the supported regions
    Show locations
    • us-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
  • KEY : the key in a key-value pair used to define a custom header
  • VALUE : the value in a key-value pair used to define a custom header

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": "update",
    "cancelRequested": false,
    "apiVersion": "v1"
  },
  "done": false
}
This command creates a long-running operation (LRO) that you can query to track progress. For more information, see Check for the result .

List all registered live configs

To list all of the live configs registered for a given location in a project, use the projects.locations.liveConfigs.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 page
  • LOCATION : the location of the live configs; use one of the supported regions
    Show locations
    • us-central1
    • us-east1
    • us-west1
    • asia-east1
    • asia-south1
    • asia-southeast1
    • europe-west1
    • southamerica-east1

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "liveConfigs": [
    {
      "name": "projects/ PROJECT_NUMBER 
/locations/ LOCATION 
/liveConfigs/ LIVE_CONFIG_ID 
",
      "sourceUri": " SOURCE_LIVESTREAM_URI 
",
      "adTagUri": " AD_TAG_URI 
",
      "state": "READY",
      "adTracking": "SERVER",
      "defaultSlate": "projects/ PROJECT_NUMBER 
/locations/ LOCATION 
/slates/ SLATE_ID 
",
      "stitchingPolicy": "CUT_CURRENT"
    },
    {
      "name": "projects/ PROJECT_NUMBER 
/locations/ LOCATION 
/liveConfigs/ my-other-live-config 
",
      "sourceUri": " my-other-live-stream-uri 
",
      "adTagUri": " my-other-ad-tag-uri 
",
      "state": "READY",
      "adTracking": "SERVER",
      "defaultSlate": "projects/ PROJECT_NUMBER 
/locations/ LOCATION 
/slates/ my-other-slate 
",
      "stitchingPolicy": "CUT_CURRENT"
    }
}

C#

Before trying this sample, follow the C# setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API C# 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 .

  using 
  
  Google.Api.Gax 
 
 ; 
 using 
  
  Google.Api.Gax.ResourceNames 
 
 ; 
 using 
  
  Google.Cloud.Video.Stitcher.V1 
 
 ; 
 using 
  
 System 
 ; 
 public 
  
 class 
  
 ListLiveConfigsSample 
 { 
  
 public 
  
 PagedEnumerable<ListLiveConfigsResponse 
 , 
  
 LiveConfig 
>  
 ListLiveConfigs 
 ( 
  
 string 
  
 projectId 
 , 
  
 string 
  
 regionId 
 ) 
  
 { 
  
 // Create the client. 
  
  VideoStitcherServiceClient 
 
  
 client 
  
 = 
  
  VideoStitcherServiceClient 
 
 . 
  Create 
 
 (); 
  
  ListLiveConfigsRequest 
 
  
 request 
  
 = 
  
 new 
  
  ListLiveConfigsRequest 
 
  
 { 
  
 ParentAsLocationName 
  
 = 
  
  LocationName 
 
 . 
  FromProjectLocation 
 
 ( 
 projectId 
 , 
  
 regionId 
 ) 
  
 }; 
  
 // Make the request. 
  
 PagedEnumerable<ListLiveConfigsResponse 
 , 
  
 LiveConfig 
>  
 response 
  
 = 
  
 client 
 . 
  ListLiveConfigs 
 
 ( 
 request 
 ); 
  
 foreach 
  
 ( 
  LiveConfig 
 
  
 liveConfig 
  
 in 
  
 response 
 ) 
  
 { 
  
 Console 
 . 
 WriteLine 
 ( 
 $"{liveConfig.Name}" 
 ); 
  
 } 
  
 // Return the result. 
  
 return 
  
 response 
 ; 
  
 } 
 } 
 

Go

Before trying this sample, follow the Go setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Go 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 
  
 ( 
  
 "context" 
  
 "fmt" 
  
 "io" 
  
 stitcher 
  
 "cloud.google.com/go/video/stitcher/apiv1" 
  
 stitcherstreampb 
  
 "cloud.google.com/go/video/stitcher/apiv1/stitcherpb" 
  
 "google.golang.org/api/iterator" 
 ) 
 // listLiveConfigs lists all live configs for a given location. 
 func 
  
 listLiveConfigs 
 ( 
 w 
  
 io 
 . 
 Writer 
 , 
  
 projectID 
  
 string 
 ) 
  
 error 
  
 { 
  
 // projectID := "my-project-id" 
  
 location 
  
 := 
  
 "us-central1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 client 
 , 
  
 err 
  
 := 
  
 stitcher 
 . 
  NewVideoStitcherClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 fmt 
 . 
 Errorf 
 ( 
 "stitcher.NewVideoStitcherClient: %w" 
 , 
  
 err 
 ) 
  
 } 
  
 defer 
  
 client 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& stitcherstreampb 
 . 
 ListLiveConfigsRequest 
 { 
  
 Parent 
 : 
  
 fmt 
 . 
 Sprintf 
 ( 
 "projects/%s/locations/%s" 
 , 
  
 projectID 
 , 
  
 location 
 ), 
  
 } 
  
 it 
  
 := 
  
 client 
 . 
 ListLiveConfigs 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 fmt 
 . 
 Fprintln 
 ( 
 w 
 , 
  
 "Live configs:" 
 ) 
  
 for 
  
 { 
  
 response 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
 Done 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 fmt 
 . 
 Errorf 
 ( 
 "it.Next(): %w" 
 , 
  
 err 
 ) 
  
 } 
  
 fmt 
 . 
 Fprintln 
 ( 
 w 
 , 
  
 response 
 . 
 GetName 
 ()) 
  
 } 
  
 return 
  
 nil 
 } 
 

Java

Before trying this sample, follow the Java setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Java 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 
  
 com.google.cloud.video.stitcher.v1. ListLiveConfigsRequest 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. LiveConfig 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. LocationName 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. VideoStitcherServiceClient 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. VideoStitcherServiceClient 
. ListLiveConfigsPagedResponse 
 
 ; 
 import 
  
 java.io.IOException 
 ; 
 public 
  
 class 
 ListLiveConfigs 
  
 { 
  
 public 
  
 static 
  
 void 
  
 main 
 ( 
 String 
 [] 
  
 args 
 ) 
  
 throws 
  
 Exception 
  
 { 
  
 // TODO(developer): Replace these variables before running the sample. 
  
 String 
  
 projectId 
  
 = 
  
 "my-project-id" 
 ; 
  
 String 
  
 location 
  
 = 
  
 "us-central1" 
 ; 
  
 listLiveConfigs 
 ( 
 projectId 
 , 
  
 location 
 ); 
  
 } 
  
 // Lists the live configs for a given project and location. 
  
 public 
  
 static 
  
  ListLiveConfigsPagedResponse 
 
  
 listLiveConfigs 
 ( 
 String 
  
 projectId 
 , 
  
 String 
  
 location 
 ) 
  
 throws 
  
 IOException 
  
 { 
  
 // Initialize client that will be used to send requests. This client only needs to be created 
  
 // once, and can be reused for multiple requests. 
  
 try 
  
 ( 
  VideoStitcherServiceClient 
 
  
 videoStitcherServiceClient 
  
 = 
  
  VideoStitcherServiceClient 
 
 . 
 create 
 ()) 
  
 { 
  
  ListLiveConfigsRequest 
 
  
 listLiveConfigsRequest 
  
 = 
  
  ListLiveConfigsRequest 
 
 . 
 newBuilder 
 () 
  
 . 
 setParent 
 ( 
  LocationName 
 
 . 
 of 
 ( 
 projectId 
 , 
  
 location 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
  VideoStitcherServiceClient 
 
 . 
  ListLiveConfigsPagedResponse 
 
  
 response 
  
 = 
  
 videoStitcherServiceClient 
 . 
 listLiveConfigs 
 ( 
 listLiveConfigsRequest 
 ); 
  
 System 
 . 
 out 
 . 
 println 
 ( 
 "Live configs:" 
 ); 
  
 for 
  
 ( 
  LiveConfig 
 
  
 liveConfig 
  
 : 
  
 response 
 . 
 iterateAll 
 ()) 
  
 { 
  
 System 
 . 
 out 
 . 
 println 
 ( 
 liveConfig 
 . 
 getName 
 ()); 
  
 } 
  
 return 
  
 response 
 ; 
  
 } 
  
 } 
 } 
 

Node.js

Before trying this sample, follow the Node.js setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Node.js 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 .

  /** 
 * TODO(developer): Uncomment these variables before running the sample. 
 */ 
 // projectId = 'my-project-id'; 
 // location = 'us-central1'; 
 // Imports the Video Stitcher library 
 const 
  
 { 
 VideoStitcherServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/video-stitcher 
' 
 ). 
 v1 
 ; 
 // Instantiates a client 
 const 
  
 stitcherClient 
  
 = 
  
 new 
  
  VideoStitcherServiceClient 
 
 (); 
 async 
  
 function 
  
 listLiveConfigs 
 () 
  
 { 
  
 const 
  
 iterable 
  
 = 
  
 await 
  
 stitcherClient 
 . 
  listLiveConfigsAsync 
 
 ({ 
  
 parent 
 : 
  
 stitcherClient 
 . 
  locationPath 
 
 ( 
 projectId 
 , 
  
 location 
 ), 
  
 }); 
  
 console 
 . 
 info 
 ( 
 'Live configs:' 
 ); 
  
 for 
  
 await 
  
 ( 
 const 
  
 response 
  
 of 
  
 iterable 
 ) 
  
 { 
  
 console 
 . 
 log 
 ( 
 response 
 . 
 name 
 ); 
  
 } 
 } 
 listLiveConfigs 
 (). 
 catch 
 ( 
 err 
  
 = 
>  
 { 
  
 console 
 . 
 error 
 ( 
 err 
 . 
 message 
 ); 
  
 process 
 . 
 exitCode 
  
 = 
  
 1 
 ; 
 }); 
 

PHP

Before trying this sample, follow the PHP setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API PHP 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 .

  use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient; 
 use Google\Cloud\Video\Stitcher\V1\ListLiveConfigsRequest; 
 /** 
 * Lists all live configs for a location. 
 * 
 * @param string $callingProjectId     The project ID to run the API call under 
 * @param string $location             The location of the live configs 
 */ 
 function list_live_configs( 
 string $callingProjectId, 
 string $location 
 ): void { 
 // Instantiate a client. 
 $stitcherClient = new VideoStitcherServiceClient(); 
 $parent = $stitcherClient->locationName($callingProjectId, $location); 
 $request = (new ListLiveConfigsRequest()) 
 ->setParent($parent); 
 $response = $stitcherClient->listLiveConfigs($request); 
 // Print the live config list. 
 $liveConfigs = $response->iterateAllElements(); 
 print('Live configs:' . PHP_EOL); 
 foreach ($liveConfigs as $liveConfig) { 
 printf('%s' . PHP_EOL, $liveConfig->getName()); 
 } 
 } 
 

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 
 ( 
 pagers 
 , 
 VideoStitcherServiceClient 
 , 
 ) 
 def 
  
 list_live_configs 
 ( 
 project_id 
 : 
 str 
 , 
 location 
 : 
 str 
 ) 
 - 
> pagers 
 . 
 ListLiveConfigsPager 
 : 
  
 """Lists all live configs in a location. 
 Args: 
 project_id: The GCP project ID. 
 location: The location of the live configs. 
 Returns: 
 An iterable object containing live config resources. 
 """ 
 client 
 = 
 VideoStitcherServiceClient 
 () 
 parent 
 = 
 f 
 "projects/ 
 { 
 project_id 
 } 
 /locations/ 
 { 
 location 
 } 
 " 
 response 
 = 
 client 
 . 
 list_live_configs 
 ( 
 parent 
 = 
 parent 
 ) 
 print 
 ( 
 "Live configs:" 
 ) 
 for 
 live_config 
 in 
 response 
 . 
 live_configs 
 : 
 print 
 ({ 
 live_config 
 . 
 name 
 }) 
 return 
 response 
 

Ruby

Before trying this sample, follow the Ruby setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Ruby 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 .

  require 
  
 "google/cloud/video/stitcher" 
 ## 
 # List live configs for a given location 
 # 
 # @param project_id [String] Your Google Cloud project (e.g. `my-project`) 
 # @param location [String] The location (e.g. `us-central1`) 
 # 
 def 
  
 list_live_configs 
  
 project_id 
 :, 
  
 location 
 : 
  
 # Create a Video Stitcher client. 
  
 client 
  
 = 
  
 Google 
 :: 
 Cloud 
 :: 
 Video 
 :: 
 Stitcher 
 . 
 video_stitcher_service 
  
 # Build the resource name of the parent. 
  
 parent 
  
 = 
  
 client 
 . 
 location_path 
  
 project 
 : 
  
 project_id 
 , 
  
 location 
 : 
  
 location 
  
 response 
  
 = 
  
 client 
 . 
 list_live_configs 
  
 parent 
 : 
  
 parent 
  
 puts 
  
 "Live configs:" 
  
 # Print out all live configs. 
  
 response 
 . 
 each 
  
 do 
  
 | 
 live_config 
 | 
  
 puts 
  
 live_config 
 . 
 name 
  
 end 
 end 
 

Additional results

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

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

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

?pageToken= NEXT_PAGE_TOKEN 

See the relevant client library for more information on using this token.

Delete a live config

If a registered live config is no longer needed, delete it using the projects.locations.liveConfigs.delete 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 page
  • LOCATION : the location of the live config; use one of the supported regions
    Show locations
    • us-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 
/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": "delete",
    "cancelRequested": false,
    "apiVersion": "v1"
  },
  "done": false
}
This command creates a long-running operation (LRO) that you can query to track progress. For more information, see Check for the result .

C#

Before trying this sample, follow the C# setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API C# 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 .

  using 
  
  Google.Cloud.Video.Stitcher.V1 
 
 ; 
 using 
  
  Google.LongRunning 
 
 ; 
 using 
  
  Google.Protobuf.WellKnownTypes 
 
 ; 
 using 
  
 System.Threading.Tasks 
 ; 
 public 
  
 class 
  
 DeleteLiveConfigSample 
 { 
  
 public 
  
 async 
  
 Task 
  
 DeleteLiveConfigAsync 
 ( 
  
 string 
  
 projectId 
 , 
  
 string 
  
 location 
 , 
  
 string 
  
 liveConfigId 
 ) 
  
 { 
  
 // Create the client. 
  
  VideoStitcherServiceClient 
 
  
 client 
  
 = 
  
  VideoStitcherServiceClient 
 
 . 
  Create 
 
 (); 
  
  DeleteLiveConfigRequest 
 
  
 request 
  
 = 
  
 new 
  
  DeleteLiveConfigRequest 
 
  
 { 
  
 LiveConfigName 
  
 = 
  
  LiveConfigName 
 
 . 
  FromProjectLocationLiveConfig 
 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 liveConfigId 
 ) 
  
 }; 
  
 // Make the request. 
  
 Operation<Empty 
 , 
  
 OperationMetadata 
>  
 response 
  
 = 
  
 await 
  
 client 
 . 
  DeleteLiveConfigAsync 
 
 ( 
 request 
 ); 
  
 // Poll until the returned long-running operation is complete. 
  
 await 
  
 response 
 . 
 PollUntilCompletedAsync 
 (); 
  
 } 
 } 
 

Go

Before trying this sample, follow the Go setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Go 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 
  
 ( 
  
 "context" 
  
 "fmt" 
  
 "io" 
  
 stitcher 
  
 "cloud.google.com/go/video/stitcher/apiv1" 
  
 stitcherstreampb 
  
 "cloud.google.com/go/video/stitcher/apiv1/stitcherpb" 
 ) 
 // deleteLiveConfig deletes a previously-created live config. 
 func 
  
 deleteLiveConfig 
 ( 
 w 
  
 io 
 . 
 Writer 
 , 
  
 projectID 
 , 
  
 liveConfigID 
  
 string 
 ) 
  
 error 
  
 { 
  
 // projectID := "my-project-id" 
  
 // liveConfigID := "my-live-config-id" 
  
 location 
  
 := 
  
 "us-central1" 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 client 
 , 
  
 err 
  
 := 
  
 stitcher 
 . 
  NewVideoStitcherClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 fmt 
 . 
 Errorf 
 ( 
 "stitcher.NewVideoStitcherClient: %w" 
 , 
  
 err 
 ) 
  
 } 
  
 defer 
  
 client 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& stitcherstreampb 
 . 
 DeleteLiveConfigRequest 
 { 
  
 Name 
 : 
  
 fmt 
 . 
 Sprintf 
 ( 
 "projects/%s/locations/%s/liveConfigs/%s" 
 , 
  
 projectID 
 , 
  
 location 
 , 
  
 liveConfigID 
 ), 
  
 } 
  
 // Deletes the live config. 
  
 op 
 , 
  
 err 
  
 := 
  
 client 
 . 
 DeleteLiveConfig 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 fmt 
 . 
 Errorf 
 ( 
 "client.DeleteLiveConfig: %w" 
 , 
  
 err 
 ) 
  
 } 
  
 err 
  
 = 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 return 
  
 err 
  
 } 
  
 fmt 
 . 
 Fprintf 
 ( 
 w 
 , 
  
 "Deleted live config" 
 ) 
  
 return 
  
 nil 
 } 
 

Java

Before trying this sample, follow the Java setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Java 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 
  
 com.google.cloud.video.stitcher.v1. DeleteLiveConfigRequest 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. LiveConfigName 
 
 ; 
 import 
  
 com.google.cloud.video.stitcher.v1. VideoStitcherServiceClient 
 
 ; 
 import 
  
 java.io.IOException 
 ; 
 import 
  
 java.util.concurrent.ExecutionException 
 ; 
 import 
  
 java.util.concurrent.TimeUnit 
 ; 
 import 
  
 java.util.concurrent.TimeoutException 
 ; 
 public 
  
 class 
 DeleteLiveConfig 
  
 { 
  
 private 
  
 static 
  
 final 
  
 int 
  
 TIMEOUT_IN_MINUTES 
  
 = 
  
 2 
 ; 
  
 public 
  
 static 
  
 void 
  
 main 
 ( 
 String 
 [] 
  
 args 
 ) 
  
 throws 
  
 Exception 
  
 { 
  
 // TODO(developer): Replace these variables before running the sample. 
  
 String 
  
 projectId 
  
 = 
  
 "my-project-id" 
 ; 
  
 String 
  
 location 
  
 = 
  
 "us-central1" 
 ; 
  
 String 
  
 liveConfigId 
  
 = 
  
 "my-live-config-id" 
 ; 
  
 deleteLiveConfig 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 liveConfigId 
 ); 
  
 } 
  
 // Deletes a live config. 
  
 public 
  
 static 
  
 void 
  
 deleteLiveConfig 
 ( 
 String 
  
 projectId 
 , 
  
 String 
  
 location 
 , 
  
 String 
  
 liveConfigId 
 ) 
  
 throws 
  
 IOException 
 , 
  
 ExecutionException 
 , 
  
 InterruptedException 
 , 
  
 TimeoutException 
  
 { 
  
 // Initialize client that will be used to send requests. This client only needs to be created 
  
 // once, and can be reused for multiple requests. 
  
 try 
  
 ( 
  VideoStitcherServiceClient 
 
  
 videoStitcherServiceClient 
  
 = 
  
  VideoStitcherServiceClient 
 
 . 
 create 
 ()) 
  
 { 
  
  DeleteLiveConfigRequest 
 
  
 deleteLiveConfigRequest 
  
 = 
  
  DeleteLiveConfigRequest 
 
 . 
 newBuilder 
 () 
  
 . 
 setName 
 ( 
  LiveConfigName 
 
 . 
 of 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 liveConfigId 
 ). 
 toString 
 ()) 
  
 . 
 build 
 (); 
  
 videoStitcherServiceClient 
  
 . 
  deleteLiveConfigAsync 
 
 ( 
 deleteLiveConfigRequest 
 ) 
  
 . 
 get 
 ( 
 TIMEOUT_IN_MINUTES 
 , 
  
 TimeUnit 
 . 
 MINUTES 
 ); 
  
 System 
 . 
 out 
 . 
 println 
 ( 
 "Deleted live config" 
 ); 
  
 } 
  
 } 
 } 
 

Node.js

Before trying this sample, follow the Node.js setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Node.js 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 .

  /** 
 * TODO(developer): Uncomment these variables before running the sample. 
 */ 
 // projectId = 'my-project-id'; 
 // location = 'us-central1'; 
 // liveConfigId = 'my-live-config-id'; 
 // Imports the Video Stitcher library 
 const 
  
 { 
 VideoStitcherServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/video-stitcher 
' 
 ). 
 v1 
 ; 
 // Instantiates a client 
 const 
  
 stitcherClient 
  
 = 
  
 new 
  
  VideoStitcherServiceClient 
 
 (); 
 async 
  
 function 
  
 deleteLiveConfig 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 : 
  
 stitcherClient 
 . 
  liveConfigPath 
 
 ( 
 projectId 
 , 
  
 location 
 , 
  
 liveConfigId 
 ), 
  
 }; 
  
 const 
  
 [ 
 operation 
 ] 
  
 = 
  
 await 
  
 stitcherClient 
 . 
 deleteLiveConfig 
 ( 
 request 
 ); 
  
 await 
  
 operation 
 . 
 promise 
 (); 
  
 console 
 . 
 log 
 ( 
 'Deleted live config' 
 ); 
 } 
 deleteLiveConfig 
 (). 
 catch 
 ( 
 err 
  
 = 
>  
 { 
  
 console 
 . 
 error 
 ( 
 err 
 . 
 message 
 ); 
  
 process 
 . 
 exitCode 
  
 = 
  
 1 
 ; 
 }); 
 

PHP

Before trying this sample, follow the PHP setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API PHP 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 .

  use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient; 
 use Google\Cloud\Video\Stitcher\V1\DeleteLiveConfigRequest; 
 /** 
 * Deletes a live config. 
 * 
 * @param string $callingProjectId     The project ID to run the API call under 
 * @param string $location             The location of the live config 
 * @param string $liveConfigId         The ID of the live config 
 */ 
 function delete_live_config( 
 string $callingProjectId, 
 string $location, 
 string $liveConfigId 
 ): void { 
 // Instantiate a client. 
 $stitcherClient = new VideoStitcherServiceClient(); 
 $formattedName = $stitcherClient->liveConfigName($callingProjectId, $location, $liveConfigId); 
 $request = (new DeleteLiveConfigRequest()) 
 ->setName($formattedName); 
 $operationResponse = $stitcherClient->deleteLiveConfig($request); 
 $operationResponse->pollUntilComplete(); 
 if ($operationResponse->operationSucceeded()) { 
 // Print status 
 printf('Deleted live config %s' . PHP_EOL, $liveConfigId); 
 } else { 
 $error = $operationResponse->getError(); 
 // handleError($error) 
 } 
 } 
 

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 
 , 
 ) 
 from 
  
 google.protobuf 
  
 import 
 empty_pb2 
 as 
 empty 
 def 
  
 delete_live_config 
 ( 
 project_id 
 : 
 str 
 , 
 location 
 : 
 str 
 , 
 live_config_id 
 : 
 str 
 ) 
 - 
> empty 
 . 
 Empty 
 : 
  
 """Deletes a live config. 
 Args: 
 project_id: The GCP project ID. 
 location: The location of the live config. 
 live_config_id: The user-defined live config ID.""" 
 client 
 = 
 VideoStitcherServiceClient 
 () 
 name 
 = 
 f 
 "projects/ 
 { 
 project_id 
 } 
 /locations/ 
 { 
 location 
 } 
 /liveConfigs/ 
 { 
 live_config_id 
 } 
 " 
 operation 
 = 
 client 
 . 
 delete_live_config 
 ( 
 name 
 = 
 name 
 ) 
 response 
 = 
 operation 
 . 
 result 
 () 
 print 
 ( 
 "Deleted live config" 
 ) 
 return 
 response 
 

Ruby

Before trying this sample, follow the Ruby setup instructions in the Video Stitcher API quickstart using client libraries . For more information, see the Video Stitcher API Ruby 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 .

  require 
  
 "google/cloud/video/stitcher" 
 ## 
 # Delete a live config 
 # 
 # @param project_id [String] Your Google Cloud project (e.g. `my-project`) 
 # @param location [String] The location (e.g. `us-central1`) 
 # @param live_config_id [String] Your live config name (e.g. `my-live-config`) 
 # 
 def 
  
 delete_live_config 
  
 project_id 
 :, 
  
 location 
 :, 
  
 live_config_id 
 : 
  
 # Create a Video Stitcher client. 
  
 client 
  
 = 
  
 Google 
 :: 
 Cloud 
 :: 
 Video 
 :: 
 Stitcher 
 . 
 video_stitcher_service 
  
 # Build the resource name of the live config. 
  
 name 
  
 = 
  
 client 
 . 
 live_config_path 
  
 project 
 : 
  
 project_id 
 , 
  
 location 
 : 
  
 location 
 , 
  
 live_config 
 : 
  
 live_config_id 
  
 # Delete the live config. 
  
 operation 
  
 = 
  
 client 
 . 
 delete_live_config 
  
 name 
 : 
  
 name 
  
 # The returned object is of type Gapic::Operation. You can use this 
  
 # object to check the status of an operation, cancel it, or wait 
  
 # for results. Here is how to block until completion: 
  
 operation 
 . 
 wait_until_done! 
  
 # Print a success message. 
  
 puts 
  
 "Deleted live config" 
 end 
 
Create a Mobile Website
View Site in Mobile | Classic
Share by: