$cd~
$mkdirsrc
$cdsrc
$gitclonehttps://chromium.googlesource.com/chromium/tools/depot_tools.git
$exportPATH=~/src/depot_tools:$PATH
$mkdirwebrtc-checkout
$cdwebrtc-checkout
$fetch--nohookswebrtc
$cdsrc
$# Latest known version to work with our builds
$gitcheckoutb00c469cad3f8c926fcf81ded90b90b6e1e62b9c
$cd..
$gclientsync
$mvsrcwebrtc
$cdwebrtc
$./build/install-build-deps.sh
$gngenout/Default--args='is_debug=false use_custom_libcxx=false rtc_include_tests=false rtc_build_examples=false dcheck_always_on=true rtc_use_x11=false use_rtti=true'
$ninja-Cout/Default
참고: 커밋 b00c469cad3f8c926fcf81ded90b90b6e1e62b9c는 도구 모음 및 abseil 업데이트로 인해 빌드와 호환되는 최신 버전입니다. 이 점은 향후 변경될 수 있습니다. 이 명령어 집합은 현재 작동하지만 기본 도구가 변경될 경우 제공된 링크를 참고해야 합니다. x64가 아닌 Debian 또는 Ubuntu Linux 변형을 빌드하는 경우 필수 구성요소 설정이 다를 수 있습니다.
libwebrtc를 빌드한 후 webrtc-checkout 디렉터리를 가리키도록 WORKSPACE 파일을 업데이트합니다. 해당 파일 상단 근처에서 webrtc_path 경로를 업데이트합니다.
webrtc_path="/usr/local/myuser/webrtc-checkout/"
Bazel을 사용하여 C++ 클라이언트를 빌드합니다.
$bazelbuild//cpp/...
참고: Bazel 7.4.1을 사용해야 합니다. 최신 버전의 Bazel이 설치되어 있는 경우 bazel-7.4.1 build/run/test ...를 사용하여 실행할 수 있습니다.
선택적으로 테스트를 실행합니다.
$bazeltest//cpp/...
OAuth 토큰 생성
Meet Media API에 연결하려면 앱에서 OAuth를 사용하여 액세스 토큰을 생성해야 합니다. OAuth를 사용하여 Google API에 액세스하는 방법을 자세히 알아보려면 OAuth 2.0을 사용하여 Google API에 액세스를 참고하세요.
기본적으로 단일 오디오 파일이 /tmp/test_output_audio.pcm에 저장됩니다.
회의 중에 동영상 스트림의 해상도가 변경될 수 있으므로 여러 동영상 파일이 생성될 수 있습니다. 동영상 파일 이름에는 증가하는 카운터와 해당 파일의 해상도가 포함됩니다. 예를 들어 동영상 스트림 해상도가 320x180에서 240x135로 변경된 후 다시 320x180으로 변경된 경우 다음 동영상 파일이 생성됩니다.
/tmp/test_output_video_0_320x180.pcm
/tmp/test_output_video_1_240x135.pcm
/tmp/test_output_video_2_320x180.pcm
(선택사항) FFmpeg를 사용하여 Linux 및 Mac에서 출력 파일 재생
FFmpeg를 사용하여 생성된 오디오 및 동영상 파일을 재생할 수 있습니다. 명령어 예시:
Linux 및 Mac
# Audio
$ffplay-fs16le-ar48k-afaformat=channel_layouts=mono\/tmp/test_output_audio.pcm
# Video## `video_size` must match the resolution in the video filename (320x180 in# this example).
$ffplay-frawvideo-pixel_formatyuv420p-video_size320x180\/tmp/test_output_video_0_320x180.yuv
옵션
샘플을 실행할 때 다음 옵션을 지정할 수 있습니다.
옵션
설명
--output_file_prefix PREFIX
출력 파일의 접두사를 지정합니다. 기본값은 /tmp_test_output_입니다.
--collection_duration DURATION
미디어를 수집할 기간을 지정합니다. 기본값은 30s입니다.
--join_timeout TIMEOUT
앱이 회의에 참여할 때까지 기다리는 시간을 지정합니다. 기본값은 2m입니다.
--meet_api_url URL
Meet Media API API의 URL을 지정합니다. 기본값은 https://meet.googleapis.com/v2alpha/입니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-29(UTC)"],[],[],null,["# Meet Media API: C++ 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 [C++ reference\nclient\nimplementation](https://github.com/googleworkspace/meet-media-api-samples). To\nlearn about the TypeScript client instead, see the [TypeScript reference client\nquickstart](/workspace/meet/media-api/guides/ts).\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- [Bazel 7.4.1](https://bazel.build/versions/7.4.0/install/ubuntu).\n- [A Google Cloud project](/workspace/guides/create-project) with Google Meet REST API enabled.\n- A Google Workspace account.\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\nBuild the C++ client\n--------------------\n\n1. The C++ implementation is built with [Bazel](https://bazel.build/). However,\n the C++ WebRTC library (*libwebrtc* ) doesn't have a working Bazel build, so\n you must build that library first by following the instructions at [WebRTC\n docs](https://webrtc.github.io/webrtc-org/native-code/development/).\n\n The following is an abbreviated version of what's explained in the\n [WebRTC docs](https://webrtc.github.io/webrtc-org/native-code/development/): \n\n $ cd ~\n $ mkdir src\n $ cd src\n $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git\n $ export PATH=~/src/depot_tools:$PATH\n $ mkdir webrtc-checkout\n $ cd webrtc-checkout\n $ fetch --nohooks webrtc\n $ cd src\n $ # Latest known version to work with our builds\n $ git checkout b00c469cad3f8c926fcf81ded90b90b6e1e62b9c\n $ cd ..\n $ gclient sync\n $ mv src webrtc\n $ cd webrtc\n $ ./build/install-build-deps.sh\n $ gn gen out/Default --args='is_debug=false use_custom_libcxx=false rtc_include_tests=false rtc_build_examples=false dcheck_always_on=true rtc_use_x11=false use_rtti=true'\n $ ninja -C out/Default\n\n \u003e **Note** : Commit `b00c469cad3f8c926fcf81ded90b90b6e1e62b9c` is the\n \u003e latest known version to work with our builds due to toolchain and abseil\n \u003e updates. This might change in the future. This set of commands works now,\n \u003e but the provided link should be referred to in case the underlying tooling\n \u003e changes. If you're building for a non-x64 Debian or Ubuntu Linux variant,\n \u003e your prerequisite setup might be different.\n2. After building *libwebrtc* , update your `WORKSPACE` file to point to your\n `webrtc-checkout` directory. Update the `webrtc_path` path near the top of\n that file:\n\n webrtc_path = \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-s2\"\u003e\"/usr/local/myuser/webrtc-checkout/\"\u003c/span\u003e \u003c/var\u003e\n\n3. Use Bazel to build the C++ client:\n\n $ bazel build //cpp/...\n\n\u003e **Note** : You should be using Bazel 7.4.1. If you have newer versions of\n\u003e Bazel installed, you can run it by using `bazel-7.4.1 build/run/test ...`\n\n1. Optionally, run the tests:\n\n $ bazel test //cpp/...\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\nYou can use the [OAuth 2.0\nPlayground](https://developers.google.com/oauthplayground) to generate tokens.\nWhen using the playground, make sure to:\n\n- Use your client ID and secret credentials from your cloud project.\n- Request the correct [scopes](/workspace/meet/media-api/guides/get-started#scopes).\n- Sign in to a Google Account and accept access.\n\nOnce complete, click the `Exchange authorization code for tokens` button and\ncopy the generated access token.\n\nStart a meeting\n---------------\n\n[Start a meeting](https://meet.google.com/new) using the same user account that\nyou used to generate the OAuth token. Copy the meeting code. You're now ready to\nrun the samples.\n\nSample apps\n-----------\n\nThe [GitHub\nrepository](https://github.com/googleworkspace/meet-media-api-samples) offers\nsamples for receiving media and participant metadata from a meeting.\n\nThese samples collect data for a specified amount of time (default is 3 seconds)\nand write the collected data to files.\n\nAudio files are in PCM16 format. Video files are in YUV420p format. These files\ncan be played by using a library such as FFmpeg.\n\nBecause video resolutions might change during a meeting, samples include the\nresolution in video file names.\n\nParticipant metadata files will be human-readable text files.\n\n### Single User Media Sample\n\nThe single user media sample is a basic app that focuses on collecting audio and\nvideo. The sample doesn't determine which participant created the audio and\nvideo data. Therefore, using this sample in a meeting with more than one\nparticipant might result in corrupted output.\n\nTo run the single user media sample, run: \n\n### Linux\n\n $ bazel run cpp/samples:single_user_media_sample -- \\\n --meeting_space_id \u003cvar translate=\"no\"\u003eMEETING_SPACE_ID\u003c/var\u003e \\\n --oauth_token \u003cvar translate=\"no\"\u003eOAUTH_TOKEN\u003c/var\u003e\n\nBy default, a single audio file is saved to `/tmp/test_output_audio.pcm`.\n\nBecause video streams might change resolutions during a meeting, multiple video\nfiles might be created. Video file names will include an incrementing counter\nand the resolution for that file. For example, if the video stream resolution\nchanged from 320x180 to 240x135 and then back to 320x180, the following video\nfiles would be created:\n\n- `/tmp/test_output_video_0_320x180.pcm`\n- `/tmp/test_output_video_1_240x135.pcm`\n- `/tmp/test_output_video_2_320x180.pcm`\n\n### (Optional) Use FFmpeg to Play Output Files on Linux and Mac\n\n[FFmpeg](https://www.ffmpeg.org/) can be used to play created audio and video\nfiles. Example commands: \n\n### Linux \\& Mac\n\n # Audio\n $ ffplay -f s16le -ar 48k -af aformat=channel_layouts=mono \\\n /tmp/test_output_audio.pcm\n\n # Video\n #\n # `video_size` must match the resolution in the video filename (320x180 in\n # this example).\n $ ffplay -f rawvideo -pixel_format yuv420p -video_size 320x180 \\\n /tmp/test_output_video_0_320x180.yuv\n\n### Options\n\nYou can specify these options when running the samples:\n\n| Option | Description |\n|------------------------------------------------------------|-------------------------------------------------------------------------------------------------|\n| `--output_file_prefix `\u003cvar translate=\"no\"\u003ePREFIX\u003c/var\u003e | Specify the prefix for output files. Defaults to `/tmp_test_output_`. |\n| `--collection_duration `\u003cvar translate=\"no\"\u003eDURATION\u003c/var\u003e | Specify how long to collect media. Defaults to `30s`. |\n| `--join_timeout `\u003cvar translate=\"no\"\u003eTIMEOUT\u003c/var\u003e | Specify how long to wait for the app to join the conference. Defaults to `2m`. |\n| `--meet_api_url `\u003cvar translate=\"no\"\u003eURL\u003c/var\u003e | Specify the URL for the Meet Media API API. Defaults to `https://meet.googleapis.com/v2alpha/`. |\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)"]]