מוודאים שמפעילים את Meet REST API בפרויקט הנכון ב-Cloud, ואז לוחצים על הבא.
מוודאים שמפעילים את Meet REST API ולוחצים על הפעלה.
CLI של gcloud
אם צריך, מגדירים את פרויקט Cloud הנוכחי לפרויקט שיצרתם:
gcloudconfigsetprojectPROJECT_ID
מחליפים את PROJECT_ID במזהה הפרויקט של פרויקט Cloud שיצרתם.
מפעילים את Meet REST API:
gcloudservicesenablemeet.googleapis.com
יצירת טוקנים של OAuth
כדי להתחבר ל-Meet Media API, האפליקציה שלכם צריכה להשתמש ב-OAuth כדי ליצור אסימוני גישה. מידע נוסף על גישה ל-Google APIs באמצעות OAuth זמין במאמר שימוש ב-OAuth 2.0 כדי לגשת אל Google APIs.
כשמפתחים אפליקציית אינטרנט, אפשר ליצור אסימוני OAuth באמצעות תהליך ההרשאה המרומזת. בדוגמה הזו של TypeScript נעשה שימוש בתהליך הזה כדי ליצור אסימוני OAuth.
[null,null,["עדכון אחרון: 2025-08-29 (שעון UTC)."],[],[],null,["# Meet Media API: TypeScript reference client quickstart\n\n| **Developer Preview:** Available as part of the [Google Workspace Developer Preview Program](https://developers.google.com/workspace/preview), which grants early access to certain features. \n|\n| **To use the Meet Media API to access real-time media from a conference, the Google Cloud project, OAuth principal, and all participants in the conference must be enrolled in the Developer Preview Program.**\n\nThis page explains how to set up and run a sample using the [TypeScript\nreference client\nimplementation](https://github.com/googleworkspace/meet-media-api-samples). To\nlearn about the C++ client instead, see the [C++ reference client\nquickstart](/workspace/meet/media-api/guides/cpp).\n\nPrerequisites\n-------------\n\nTo run this quickstart, you need the following prerequisites:\n\n- You've cloned the [GitHub\n repository](https://github.com/googleworkspace/meet-media-api-samples).\n- [Webpack](https://webpack.js.org/).\n- [Node.js](https://nodejs.org).\n- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install).\n- [`gcloud`](https://cloud.google.com/sdk/docs/install-sdk) CLI.\n- [A Google Cloud project](/workspace/guides/create-project) with Google Meet REST API enabled.\n- A Google Workspace account.\n- Use a Chrome browser with version \\\u003e= 94.\n\n### Enable the Meet REST API\n\nBefore using Google APIs, you need to turn them on in a Google Cloud project. You can turn on one or more APIs in a single Google Cloud project. \n\n### Google Cloud console\n\n1. In the Google Cloud console, enable the Meet REST API.\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=meet.googleapis.com)\n2. Confirm that you're enabling the Meet REST API in the correct\n Cloud project, then click **Next**.\n\n3. Confirm that you're enabling the Meet REST API, then click\n **Enable**.\n\n### gcloud CLI\n\n1. If necessary, set the current Cloud project to the one you\n created:\n\n gcloud config set project \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the **Project ID** of the\n Cloud project you created.\n2. Enable the Meet REST API:\n\n gcloud services enable meet.googleapis.com\n\nGenerate OAuth tokens\n---------------------\n\nTo connect to the Meet Media API, your app must use OAuth to generate\naccess tokens. To learn more about accessing Google APIs with OAuth, see [*Using\nOAuth 2.0 to Access Google APIs*](/identity/protocols/oauth2).\n\nWhen building a web app, you can generate OAuth tokens using the [implicit grant\nflow](/identity/protocols/oauth2/javascript-implicit-flow). This TypeScript\nsample uses this flow to generate OAuth tokens.\n\nRun the sample\n--------------\n\n| **Note:** Due to CORS requirements, you must deploy this sample for it to call the Meet REST API. `localhost` won't work. We recommend deploying the sample to [*Google App Engine*](https://cloud.google.com/appengine).\n\n1. [Create an OAuth client](/identity/protocols/oauth2/javascript-implicit-flow#prerequisites)\n\n2. Within the `web/samples` directory, build the sample:\n\n $ yarn install --frozen-lockfile\n $ webpack\n\n3. Follow the\n [*Authenticate for using the gcloud CLI*](https://cloud.google.com/docs/authentication/gcloud)\n guide to sign in and select your Google Cloud project.\n\n4. Deploy your server to [*Google App Engine*](https://cloud.google.com/appengine).\n\n $ gcloud app deploy app.yaml\n\n5. Navigate to your endpoint:\n\n $ gcloud app browse\n\n6. Follow the [*Create access credentials*](/workspace/guides/create-credentials#oauth-client-id)\n guide to create OAuth 2.0 credentials with these scopes:\n\n - `https://www.googleapis.com/auth/meetings.conference.media.readonly`\n - `https://www.googleapis.com/auth/meetings.space.readonly`\n\n Add your deployed app's URL to *Authorized JavaScript Origins* and\n *Authorized Redirect URIs*.\n7. Copy the client ID and paste it into the deployed web page.\n\n8. Tap the sign-in button and follow the prompts. If you run into an error,\n note that it might take a few minutes for the redirect URIs to propagate.\n\n9. [Create and join a meeting](https://meet.google.com/new). Copy the meeting\n code, pasting it into the \"meeting code\" input on the page.\n\n10. Select the number of video streams and enable audio.\n\n11. Click *Create Client* , then *Join Meeting*.\n\n12. Observe the video and audio streams.\n\nRelated topics\n--------------\n\n- [Troubleshoot and fix Meet Media API errors](/workspace/meet/media-api/guides/troubleshoot)\n\n- [Meet Media API data channels reference](/workspace/meet/media-api/reference/dc/media_api)"]]