Sebelum Anda memulai

Halaman ini menunjukkan cara menyiapkan project Google Cloud dan mengonfigurasi akun layanan untuk mengakses project.

Menyiapkan project Google Cloud

Ikuti langkah-langkah berikut untuk menyiapkan Google Cloud project.

  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. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Video Stitcher API.

    Enable the API

  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 Video Stitcher Admin role to the service account.

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

    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. Verify that billing is enabled for your Google Cloud project.

  10. Enable the Video Stitcher API.

    Enable the API

  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 Video Stitcher Admin role to the service account.

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

    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. Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.

  16. Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:

    gcloud init
  17. Gunakan gcloud CLI untuk menguji lingkungan autentikasi Anda. Pastikan perintah berikut menampilkan string teks tanpa error:
    gcloud auth application-default print-access-token
  18. Aktifkan akun layanan

    1. Di terminal, tetapkan project aktif untuk perintah gcloud. Ganti YOUR_PROJECT_ID dengan project ID Anda.
      gcloud config set project YOUR_PROJECT_ID
    2. Aktifkan akun layanan. Ganti PATH_TO_YOUR_SERVICE_KEY dengan jalur ke file JSON yang Anda download ke komputer lokal Anda.
      gcloud auth activate-service-account --key-file PATH_TO_YOUR_SERVICE_KEY

    Anda akan menggunakan akun layanan ini untuk mengizinkan akses dan memanggil Video Stitcher API.

    Buat akun layanan dengan hanya izin untuk membuat sesi

    Karena token OAuth akan diteruskan ke aplikasi klien, buat akun layanan terpisah dengan hanya izin untuk membuat sesi; sehingga token OAuth yang bocor tidak dapat membahayakan resource Anda, seperti konfigurasi VOD/live atau kunci CDN.

    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 Video Stitcher User role to the service account.

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

    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.

    Penyiapan livestream

    Jika Anda menyisipkan iklan ke livestream, ikuti langkah-langkah di bagian ini (atau lihat langkah-langkah untuk VOD).

    Setelah akun layanan dibuat, Anda harus menautkan akun layanan tersebut ke akun Ad Manager Anda. Hal ini memungkinkan Video Stitcher API membuat peristiwa livestream atas nama Anda. Untuk melakukannya, ikuti langkah-langkah untuk memberikan akses ke akun layanan Anda:

    1. Login ke Google Ad Manager (GAM).
    2. Klik Admin > Setelan Global.
    3. Pastikan Akses API diaktifkan.
    4. Klik Tambah pengguna akun layanan.
    5. Isi formulir, termasuk alamat email akun layanan yang dibuat sebelumnya.
    6. Pilih peran, yang harus mencakup izin Manage video content with dynamic ad insertion from Google Cloud Video Stitcher. Anda harus membuat peran khusus bernama Pengelola Live Stream khusus untuk pengelolaan akun layanan ini. Peran khusus harus memiliki setidaknya izin berikut:
      • Mengelola konten video dengan penyisipan iklan dinamis dari Penggabung Video Google Cloud
      • Lihat materi iklan (diperlukan oleh izin sebelumnya)
      • Melihat konten video, paket, dan metadata
      • Melihat sumber konten
    7. Jika jaringan Ad Manager Anda menggunakan tim, Anda harus menetapkan tim "Semua entitas" ke pengguna akun layanan.
    8. Klik Simpan dan konfirmasi penambahan akun layanan.

    Membuat livestream

    Anda dapat menggunakan salah satu panduan memulai Live Stream API untuk menyiapkan livestream. Live stream HLS dan MPEG-DASH didukung (lihat persyaratan manifes sumber). Prosedur ini bersifat opsional; Anda dapat menggunakan livestream yang sudah ada.

    Panduan memulai cepat Live Stream API menggunakan Kredensial Default Aplikasi untuk autentikasi, tetapi Anda dapat menggunakan akun layanan yang telah disiapkan. Untuk opsi ini, pastikan akun layanan memiliki peran Editor Live Stream.

    Pastikan untuk menjaga live stream tetap aktif; jangan ikuti langkah-langkah di bagian Membersihkan hingga Anda selesai melakukan live stream.

    Persyaratan manifes sumber

    Video Stitcher API mendaftarkan konfigurasi dengan Ad Manager dengan mengurai manifest sumber. Manifes sumber harus memiliki karakteristik tertentu, bergantung pada formatnya.

    HLS

    • Format penampung dapat berupa:
      • MPEG-TS yang di-mux
      • MPEG-TS yang tidak di-demux
      • FMP4 yang tidak di-mux
    • Setidaknya satu redisi dalam manifes dengan kolom berikut (diisi dengan benar):
      • codec
      • bandwidth

    MPEG-DASH

    • MPD@type ditetapkan ke dinamis (@type="dynamic")
    • MPD@profiles mencakup profil Live ISO urn:mpeg:dash:profile:isoff-live:2011
    • Harus multi-periode dengan setiap periode berisi satu atau beberapa Set Adaptasi
    • Setiap Set Adaptasi berisi satu atau beberapa Representasi
    • Representasi berisi atau mewarisi SegmentTemplate dengan ID $Number$ atau $Time$
    • @segmentAlignment ditetapkan ke benar untuk semua Kumpulan Adaptasi
    • Representasi tidak boleh kosong

    Penyiapan streaming VOD

    Jika Anda menyisipkan iklan ke dalam streaming VOD, ikuti langkah-langkah di bagian ini (atau lihat langkah-langkah untuk livestream).

    Buat file sumber VOD

    Alur kerja ini memerlukan file manifes MPEG-DASH (MPD), atau file manifes HTTP Live Streaming (HLS) (M3U8), dan file segmen terkait. Anda dapat menggunakan file VOD yang sudah ada atau membuat file sumber VOD menggunakan Transcoder API.