تأیید کنید که Meet REST API را در پروژه Cloud صحیح فعال میکنید، سپس روی Next کلیک کنید.
تأیید کنید که Meet REST API را فعال میکنید، سپس روی فعال کردن کلیک کنید.
gcloud CLI
در صورت لزوم، پروژه فعلی Cloud را روی پروژه ای که ایجاد کرده اید تنظیم کنید:
gcloudconfigsetprojectPROJECT_ID
PROJECT_ID با Project ID پروژه Cloud که ایجاد کردید جایگزین کنید.
فعال کردن Meet REST API:
gcloudservicesenablemeet.googleapis.com
توکن های OAuth را ایجاد کنید
برای اتصال به Meet Media API، برنامه شما باید از OAuth برای تولید نشانههای دسترسی استفاده کند. برای کسب اطلاعات بیشتر در مورد دسترسی به Google API با OAuth، به استفاده از OAuth 2.0 برای دسترسی به Google API مراجعه کنید.
هنگام ساختن یک برنامه وب، می توانید توکن های OAuth را با استفاده از جریان اعطای ضمنی ایجاد کنید. این نمونه TypeScript از این جریان برای تولید توکن های OAuth استفاده می کند.
URL برنامه مستقر شده خود را به مبداهای مجاز جاوا اسکریپت و URIهای مجاز تغییر مسیر اضافه کنید.
شناسه مشتری را کپی کرده و آن را در صفحه وب مستقر شده قرار دهید.
روی دکمه ورود ضربه بزنید و دستورات را دنبال کنید. اگر با خطایی مواجه شدید، توجه داشته باشید که ممکن است چند دقیقه طول بکشد تا URI های تغییر مسیر منتشر شوند.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[],[],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)"]]