將用戶端指標上傳至 Meet Media API
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google Meet Media API 用戶端必須透過 media-stats
資料管道,定期上傳用戶端統計資料。
Meet Media API 需要的項目是 WebRTC 收集的統計資料子集,可透過呼叫 RTCPeerConnection::getStats()
方法存取。
用戶端流程
所有 Meet Media API 用戶端都必須實作下列流程。
初始設定
用戶端開啟 media-stats
資料通道後,Meet 會立即透過該通道傳送 MediaStatsConfiguration
資源更新。這項設定會指定用戶端應如何上傳統計資料。
上傳統計資料
連線至會議時,Meet Media API 用戶端必須:
以 uploadIntervalSeconds
指定的時間間隔呼叫 RTCPeerConnection::getStats()
方法。
將產生的統計資料物件篩選至 allowlist
指定的欄位。
透過 media-stats
資料管道傳送 UploadMediaStatsRequest
,上傳篩選後的統計資料。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[],[],null,["# Upload client metrics to the Meet Media API\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\nGoogle Meet Media API clients must periodically upload client statistics over\nthe `media-stats` data channel.\n\nThe entries required by the Meet Media API are a subset of the\n[statistics](https://w3c.github.io/webrtc-pc/#mandatory-to-implement-stats)\ngathered by WebRTC, which are accessible by calling the\n`RTCPeerConnection::getStats()` method.\n\nClient flow\n-----------\n\nAll Meet Media API clients must implement the following flow.\n| **Tip:** The provided reference clients ([C++](/workspace/meet/media-api/guides/cpp), [TypeScript](/workspace/meet/media-api/guides/ts)) show how to implement this flow.\n\n### Initial configuration\n\nAfter the client opens the `media-stats` data channel, Meet\nimmediately sends a\n[`MediaStatsConfiguration`](/workspace/meet/media-api/reference/dc/media_api.mediastatsconfiguration)\nresource update over the channel. This configuration specifies how the client\nshould upload stats.\n\n| Configuration |\n|---------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|\n| [`uploadIntervalSeconds`](/workspace/meet/media-api/reference/dc/media_api.mediastatsconfiguration.uploadintervalseconds) | Specifies how frequently the Meet Media API client should upload statistics, or zero if the client shouldn't upload any. |\n| [`allowlist`](/workspace/meet/media-api/reference/dc/media_api.mediastatsconfiguration.allowlist) | Specifies which `RTCPeerConnection::getStats()` entries the client should upload. |\n\n### Stats upload\n\nWhile connected to a conference, the Meet Media API client must:\n\n1. Call the `RTCPeerConnection::getStats()` method at the interval specified by\n [`uploadIntervalSeconds`](/workspace/meet/media-api/reference/dc/media_api.mediastatsconfiguration.uploadintervalseconds).\n\n2. Filter the resulting stats object down to the fields specified by\n [`allowlist`](/workspace/meet/media-api/reference/dc/media_api.mediastatsconfiguration.allowlist).\n\n3. Upload the filtered stats by sending a [`UploadMediaStatsRequest`](/workspace/meet/media-api/reference/dc/media_api.uploadmediastatsrequest)\n across the `media-stats` data channel.\n\nRelated topics\n--------------\n\n- [Meet Media API concepts](/workspace/meet/media-api/guides/concepts)\n- [Get started with Meet Media API](/workspace/meet/media-api/guides/get-started)"]]