Ihre Clientanwendung für die Zusammenarbeit mit Google Ad Manager vorbereiten
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Erforderliche Informationen für Ihre Clientanwendungen erfassen
Du solltest die folgenden Informationen haben, die für die Erstellung einer Livestreamsitzung in Google Ad Manager erforderlich sind:
Feld
Beschreibung
projectNumber
Die Google Cloud Projektnummer (PROJECT_NUMBER), die zum Erstellen von Ad Manager-fähigen Sitzungen verwendet wird. Alternativ können Sie auch die Projekt-ID verwenden.
region
Der Speicherort (LOCATION), an dem die Livekonfiguration registriert ist.
liveConfigId
Die Live-Konfigurations-ID, mit der das Livestreamereignis bei der Video Stitcher API registriert wurde. Im Folgenden sehen Sie das Format für den vollständigen Namen der Konfigurationsressource:
Die Konfigurations-ID ist der letzte Teil des vollständigen Namens (LIVE_CONFIG_ID). Der Speicherort der Konfiguration muss mit dem Speicherort übereinstimmen, an dem du die Sitzung erstellst.
customAssetKey
Der benutzerdefinierte Asset-Schlüssel (CUSTOM_ASSET_KEY), der bei der Registrierung der Livekonfiguration erstellt wurde. Der Wert ist für das IMA SDK erforderlich, um den Stream zu erstellen.
networkCode
Die numerische Kennung (NETWORK_CODE) für Ihr Ad Manager-Netzwerk.
oAuthToken
Ein kurzlebiges OAuth-Token für das Dienstkonto mit der Rolle Video Stitcher User. Weitere Informationen finden Sie unter Kurzlebige OAuth-Tokens generieren.
Tabelle 1. Erforderliche Informationen für Ad Manager-kompatible Livestreamsitzungen
Rufen Sie das OAuth 2.0-Inhabertoken aus dem Dienstkonto ab:
gcloudauthprint-access-token
Da es sich um ein kurzlebiges Token handelt, müssen Sie es regelmäßig mit dem Befehl gcloud auth print-access-token neu generieren und die neuen Tokens an Ihre Clientanwendungen senden. Im folgenden Abschnitt finden Sie weitere Informationen zum Erstellen eines Produktionsdienstes für kurzlebige Tokens.
Dienst zum Bereitstellen von Informationen für Ihre Clientanwendungen erstellen
Erstellen Sie einen Dienst, der die erforderlichen Informationen bereitstellen kann, die an den Client übergeben werden sollen. Wenn die Anwendung Informationen zum Abspielen eines Livestreams von deinem Dienst anfordert, sollte der Dienst die in Tabelle 1 beschriebenen Informationen zurückgeben.
Insbesondere muss der Dienst OAuth-Tokens auf sichere Weise für Clientanwendungen bereitstellen können. Konfigurieren Sie diesen Dienst mit zwei Dienstkonten, wobei eines sich als das andere ausgibt.
Ein Dienstkonto hat die Rolle Service Token Creator und erstellt ein OAuth-Token für das Dienstkonto mit der Rolle Video Stitcher User. Beispiel:
Dienstkonto 1: Dies ist das Dienstkonto des Aufrufers. Dieses Konto hat die Berechtigung Ersteller von Diensttokens für Dienstkonto 2 und übernimmt die Identität von Dienstkonto 2 für Clientanwendungen.
Dienstkonto 2: Das ist das Dienstkonto mit Berechtigungen, das die Rolle Video Stitcher User hat, um Sitzungen zu erstellen.
Informationen zum Bereitstellen eines OAuth-Tokens über Ihren Dienst, einschließlich Beispielcode für Clientbibliotheken, finden Sie unter Kurzlebiges Zugriffstoken erstellen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Prepare for your client application to work with Google Ad Manager\n\nCollect the required information for your client applications\n-------------------------------------------------------------\n\nYou should have the following information that is required for\nGoogle Ad Manager to create a live stream session:\n\n**Table 1.** Required information for Ad Manager-enabled live stream sessions\n\nGenerate short-lived OAuth tokens for testing\n---------------------------------------------\n\nTo generate a\n[short-lived OAuth token](/iam/docs/creating-short-lived-service-account-credentials)\nassociated with the\n[service account](/video-stitcher/docs/how-to/gam/before-you-begin#create-service-account-to-create-sessions) with the **Video Stitcher User** role, follow\nthese steps:\n\n1. Replace \u003cvar translate=\"no\"\u003ePATH_TO_YOUR_SERVICE_KEY\u003c/var\u003e with the path to the JSON file you downloaded to your local machine. \n\n ```bash\n gcloud auth activate-service-account --key-file PATH_TO_YOUR_SERVICE_KEY\n ```\n2. Retrieve the OAuth 2.0 bearer token from the service account: \n\n ```bash\n gcloud auth print-access-token\n ```\n\nBecause this is a short-lived token, you need to generate it again\nperiodically with the `gcloud auth print-access-token` command and send the new\ntokens to your client applications. See the following section for more\ninformation on building a production service to provide short-lived tokens.\n| **Important:** Regenerating an OAuth token is a time-consuming operation. Try to reuse an OAuth token as much as possible when creating sessions. You can extend the lifetime of a token using the [`--lifetime` flag](/sdk/gcloud/reference/auth/application-default/print-access-token).\n\nCreate a service to provide information to your client applications\n-------------------------------------------------------------------\n\nCreate a service that can provide the required information to be passed to the\nclient. When the application requests information from your service on how to\nplay a live stream, the service should return the information described in\n[Table 1](#collect-info).\n\nIn particular, the service must be able to provide OAuth tokens to\nclient applications in a secure manner. Configure this service using two service\naccounts, one\n[impersonating the other](/docs/authentication/use-service-account-impersonation).\nOne service account has the **Service Token Creator** role and creates an OAuth\ntoken for the service account that has the **Video Stitcher User** role. For\nexample:\n\n- Service account 1: This is the caller service account. This account has the **Service Token Creator** permission on service account 2 and impersonates service account 2 to client applications.\n- Service account 2: This is the privilege-bearing service account that has the **Video Stitcher User** role to create sessions.\n\nFor information on providing an OAuth token from your service, including client\nlibrary code samples, see\n[Create a short-lived access token](/iam/docs/create-short-lived-credentials-direct#sa-credentials-oauth)."]]