Listar detalhes do ponto VOD

Lista todos os detalhes de ponto do editor de vídeo para uma sessão de VOD.

Mais informações

Para ver a documentação detalhada que inclui este exemplo de código, consulte:

Exemplo de código

C#

Antes de testar esta amostra, siga as instruções de configuração de C# no Guia de início rápido da API Video Stitcher usando bibliotecas de cliente. Para saber mais, consulte a documentação de referência da API C# da API Video Stitcher.

Para autenticar a API Video Stitcher, configure o Application Default Credentials. Para mais informações, consulte Configurar a autenticação para um ambiente de desenvolvimento local.


using Google.Api.Gax;
using Google.Cloud.Video.Stitcher.V1;

public class ListVodStitchDetailsSample
{
    public PagedEnumerable<ListVodStitchDetailsResponse, VodStitchDetail> ListVodStitchDetails(
        string projectId, string regionId, string sessionId)
    {
        // Create the client.
        VideoStitcherServiceClient client = VideoStitcherServiceClient.Create();

        ListVodStitchDetailsRequest request = new ListVodStitchDetailsRequest
        {
            ParentAsVodSessionName = VodSessionName.FromProjectLocationVodSession(projectId, regionId, sessionId)
        };

        // Make the request.
        PagedEnumerable<ListVodStitchDetailsResponse, VodStitchDetail> response = client.ListVodStitchDetails(request);

        // Return the result.
        return response;
    }
}

Go

Antes de testar esta amostra, siga as instruções de configuração de Go no Guia de início rápido da API Video Stitcher usando bibliotecas de cliente. Para saber mais, consulte a documentação de referência da API Go da API Video Stitcher.

Para autenticar a API Video Stitcher, configure o Application Default Credentials. Para mais informações, consulte Configurar a autenticação para um ambiente de desenvolvimento local.

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"
)

// listVodStitchDetails lists the stitch details for a video on demand (VOD) session.
func listVodStitchDetails(w io.Writer, projectID, sessionID string) error {
	// projectID := "my-project-id"
	// sessionID := "123-456-789"
	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.ListVodStitchDetailsRequest{
		Parent: fmt.Sprintf("projects/%s/locations/%s/vodSessions/%s", projectID, location, sessionID),
	}

	it := client.ListVodStitchDetails(ctx, req)
	fmt.Fprintln(w, "VOD stitch details:")
	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

Antes de testar esta amostra, siga as instruções de configuração de Java no Guia de início rápido da API Video Stitcher usando bibliotecas de cliente. Para saber mais, consulte a documentação de referência da API Java da API Video Stitcher.

Para autenticar a API Video Stitcher, configure o Application Default Credentials. Para mais informações, consulte Configurar a autenticação para um ambiente de desenvolvimento local.


import com.google.cloud.video.stitcher.v1.ListVodStitchDetailsRequest;
import com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient;
import com.google.cloud.video.stitcher.v1.VodSessionName;
import com.google.cloud.video.stitcher.v1.VodStitchDetail;
import java.io.IOException;

public class ListVodStitchDetails {

  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 sessionId = "my-session-id";

    listVodStitchDetails(projectId, location, sessionId);
  }

  public static void listVodStitchDetails(String projectId, String location, String sessionId)
      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. In this example, try-with-resources is used
    // which automatically calls close() on the client to clean up resources.
    try (VideoStitcherServiceClient videoStitcherServiceClient =
        VideoStitcherServiceClient.create()) {
      ListVodStitchDetailsRequest listVodStitchDetailsRequest =
          ListVodStitchDetailsRequest.newBuilder()
              .setParent(VodSessionName.of(projectId, location, sessionId).toString())
              .build();

      VideoStitcherServiceClient.ListVodStitchDetailsPagedResponse response =
          videoStitcherServiceClient.listVodStitchDetails(listVodStitchDetailsRequest);
      System.out.println("VOD stitch details:");

      for (VodStitchDetail stitchDetail : response.iterateAll()) {
        System.out.println(stitchDetail.toString());
      }
    }
  }
}

Node.js

Antes de testar esta amostra, siga as instruções de configuração de Node.js no Guia de início rápido da API Video Stitcher usando bibliotecas de cliente. Para saber mais, consulte a documentação de referência da API Node.js da API Video Stitcher.

Para autenticar a API Video Stitcher, configure o Application Default Credentials. Para mais informações, consulte Configurar a autenticação para um ambiente de desenvolvimento local.

/**
 * TODO(developer): Uncomment these variables before running the sample.
 */
// projectId = 'my-project-id';
// location = 'us-central1';
// sessionId = 'my-session-id';

// Imports the Video Stitcher library
const {VideoStitcherServiceClient} =
  require('@google-cloud/video-stitcher').v1;
// Instantiates a client
const stitcherClient = new VideoStitcherServiceClient();

async function listVodStitchDetails() {
  // Construct request
  const request = {
    parent: stitcherClient.vodSessionPath(projectId, location, sessionId),
  };
  const iterable = await stitcherClient.listVodStitchDetailsAsync(request);
  console.log('VOD stitch details:');
  for await (const response of iterable) {
    console.log(response.name);
  }
}

listVodStitchDetails();

PHP

Antes de testar esta amostra, siga as instruções de configuração do PHP no Guia de início rápido da API Video Stitcher usando bibliotecas de cliente. Para saber mais, consulte a documentação de referência da API PHP da API Video Stitcher.

Para autenticar a API Video Stitcher, configure o Application Default Credentials. Para mais informações, consulte Configurar a autenticação para um ambiente de desenvolvimento local.

use Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient;
use Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsRequest;

/**
 * Lists the stitch details for the specified VOD session.
 *
 * @param string $callingProjectId     The project ID to run the API call under
 * @param string $location             The location of the session
 * @param string $sessionId            The ID of the session
 */
function list_vod_stitch_details(
    string $callingProjectId,
    string $location,
    string $sessionId
): void {
    // Instantiate a client.
    $stitcherClient = new VideoStitcherServiceClient();

    $formattedName = $stitcherClient->vodSessionName($callingProjectId, $location, $sessionId);
    $request = (new ListVodStitchDetailsRequest())
        ->setParent($formattedName);
    $response = $stitcherClient->listVodStitchDetails($request);

    // Print the stitch details list.
    $stitchDetails = $response->iterateAllElements();
    print('VOD stitch details:' . PHP_EOL);
    foreach ($stitchDetails as $stitchDetail) {
        printf('%s' . PHP_EOL, $stitchDetail->getName());
    }
}

Python

Antes de testar esta amostra, siga as instruções de configuração do Python no Guia de início rápido da API Video Stitcher usando bibliotecas de cliente. Para saber mais, consulte a documentação de referência da API Python da API Video Stitcher.

Para autenticar a API Video Stitcher, configure o Application Default Credentials. Para mais informações, consulte Configurar a autenticação para um ambiente de desenvolvimento local.


import argparse

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

def list_vod_stitch_details(
    project_id: str, location: str, session_id: str
) -> pagers.ListVodStitchDetailsPager:
    """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.

    Returns:
        An iterable object containing VOD stitch details resources.
    """

    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

Ruby

Antes de testar esta amostra, siga as instruções de configuração do Ruby no Guia de início rápido da API Video Stitcher usando bibliotecas de cliente. Para saber mais, consulte a documentação de referência da API Ruby da API Video Stitcher.

Para autenticar a API Video Stitcher, configure o Application Default Credentials. Para mais informações, consulte Configurar a autenticação para um ambiente de desenvolvimento local.

require "google/cloud/video/stitcher"

##
# List the stitch details for a VOD session
#
# @param project_id [String] Your Google Cloud project (e.g. "my-project")
# @param location [String] The location (e.g. "us-central1")
# @param session_id [String] The VOD session ID (e.g. "my-vod-session-id")
#
def list_vod_stitch_details project_id:, location:, session_id:
  # Create a Video Stitcher client.
  client = Google::Cloud::Video::Stitcher.video_stitcher_service

  # Build the resource name of the parent.
  parent = client.vod_session_path project: project_id, location: location,
                                   vod_session: session_id

  # List all stitch details for the VOD session.
  response = client.list_vod_stitch_details parent: parent

  puts "VOD stitch details:"
  # Print out all VOD stitch details.
  response.each do |vod_stitch_detail|
    puts vod_stitch_detail.name
  end
end

A seguir

Para pesquisar e filtrar amostras de código para outros produtos do Google Cloud, consulte o navegador de amostra do Google Cloud.