Antes de começar

Nesta página, mostramos como configurar um projeto do Google Cloud e configurar contas de serviço para acessar o projeto.

Configure um projeto do Google Cloud

Siga estas etapas para configurar um projeto do Google Cloud:

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Video Stitcher and Live Stream APIs.

    Enable the APIs

  5. Create a service account:

    1. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    2. Select your project.
    3. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    4. Click Create and continue.
    5. Grant the following roles to the service account: Video Stitcher Admin, Live Stream Editor, Storage Admin.

      To grant a role, find the Select a role list, then select the role.

      To grant additional roles, click Add another role and add each additional role.

    6. Click Continue.
    7. Click Done to finish creating the service account.

      Do not close your browser window. You will use it in the next step.

  6. Create a service account key:

    1. In the Google Cloud console, click the email address for the service account that you created.
    2. Click Keys.
    3. Click Add key, and then click Create new key.
    4. Click Create. A JSON key file is downloaded to your computer.
    5. Click Close.
  7. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON file that contains your credentials. This variable applies only to your current shell session, so if you open a new session, set the variable again.

  8. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  9. Make sure that billing is enabled for your Google Cloud project.

  10. Enable the Video Stitcher and Live Stream APIs.

    Enable the APIs

  11. Create a service account:

    1. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    2. Select your project.
    3. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    4. Click Create and continue.
    5. Grant the following roles to the service account: Video Stitcher Admin, Live Stream Editor, Storage Admin.

      To grant a role, find the Select a role list, then select the role.

      To grant additional roles, click Add another role and add each additional role.

    6. Click Continue.
    7. Click Done to finish creating the service account.

      Do not close your browser window. You will use it in the next step.

  12. Create a service account key:

    1. In the Google Cloud console, click the email address for the service account that you created.
    2. Click Keys.
    3. Click Add key, and then click Create new key.
    4. Click Create. A JSON key file is downloaded to your computer.
    5. Click Close.
  13. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON file that contains your credentials. This variable applies only to your current shell session, so if you open a new session, set the variable again.

  14. Install the Google Cloud CLI.
  15. To initialize the gcloud CLI, run the following command:

    gcloud init
  16. Use a ferramenta gcloud para testar o ambiente de autenticação. Verifique se o comando a seguir gera uma string de texto sem erros:
    gcloud auth application-default print-access-token

Ativar a conta de serviço

  1. No terminal, defina o projeto ativo para comandos gcloud. Substitua YOUR_PROJECT_ID pelo ID do projeto.
    gcloud config set project YOUR_PROJECT_ID
    
  2. Ative a conta de serviço. Substitua PATH_TO_YOUR_SERVICE_KEY pelo caminho do arquivo JSON que você salvou na máquina local.
    gcloud auth activate-service-account --key-file PATH_TO_YOUR_SERVICE_KEY
    

Você vai usar essa conta de serviço para autorizar o acesso e chamar a API Video Stitcher.

Depois que a conta de serviço for criada, vincule essa conta de serviço à sua conta do Ad Manager. Isso permite que a API Video Stitcher crie eventos de transmissão ao vivo em seu nome. Siga as etapas para conceder acesso à sua conta de serviço:

  1. Faça login no Google Ad Manager (GAM).
  2. Clique em Administrador > Configurações globais.
  3. Verifique se o acesso à API está ativado.
  4. Clique em Adicionar um usuário da conta de serviço.
  5. Preencha o formulário, incluindo o endereço de e-mail da conta de serviço criada anteriormente.
  6. Selecione um papel, que precisa incluir a permissão Gerenciar conteúdo de vídeo com inserção de anúncios dinâmicos do editor de vídeos do Google Cloud. Crie um papel personalizado chamado Gerenciador de transmissões ao vivo especificamente para o gerenciamento dessa conta de serviço. O papel personalizado precisa ter pelo menos as seguintes permissões:
    • Gerenciar o conteúdo de vídeo com a Inserção de anúncios dinâmicos do editor de vídeos do Google Cloud
    • Visualizar criativos (exigido pela permissão anterior)
    • Ver conteúdo, pacotes e metadados de vídeo
    • Conferir origens do conteúdo
  7. Clique em Salvar e confirme a adição da conta de serviço.

Criar uma conta de serviço somente com permissões para criar sessões

Como um token OAuth será transmitido para um aplicativo cliente, crie uma conta de serviço separada somente com permissões para criar uma sessão. Assim, um token OAuth vazado não poderá comprometer seus recursos, como chaves de CDN e eventos de transmissão ao vivo.

Create a service account:

  1. In the Google Cloud console, go to the Create service account page.

    Go to Create service account
  2. Select your project.
  3. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

    In the Service account description field, enter a description. For example, Service account for quickstart.

  4. Click Create and continue.
  5. Grant the following roles to the service account: Video Stitcher User.

    To grant a role, find the Select a role list, then select the role.

    To grant additional roles, click Add another role and add each additional role.

  6. Click Continue.
  7. Click Done to finish creating the service account.

    Do not close your browser window. You will use it in the next step.

Create a service account key:

  1. In the Google Cloud console, click the email address for the service account that you created.
  2. Click Keys.
  3. Click Add key, and then click Create new key.
  4. Click Create. A JSON key file is downloaded to your computer.
  5. Click Close.