RTC 統計情報 API¶
統計情報更新のタイミングについて¶
この統計情報は、クライアントからシグナリングで送信されてくる統計情報の最新の値を返します。 デフォルトでは WebSocket と DataChannel 経由のどちらも 60 秒間隔で更新されます。
間隔は以下で変更できます。
ListRtcStats¶
バージョン 2024.1.0 で追加。
- x-sora-target:
Sora_20211215.ListRtcStats
すべての RTC 統計情報の一覧を取得します。
キー |
型 |
デフォルト |
|---|---|---|
local (オプション) |
boolean |
true |
local はクラスター機能利用時に、全てのノードの情報を取得するかどうかを指定します。
$ curl -sS \
-X POST \
http://127.0.0.1:3000/ \
-H "x-sora-target: Sora_20211215.ListRtcStats" \
| jq .
[
{
"channel_id": "sora",
"connection_id": "FNRGZ8VFSN3R98DK7NBA38MFNR",
"timestamp": "2021-11-13T13:05:33.264Z",
"rtc_stats": [
{
"audioLevel": 0,
"id": "RTCAudioSource_1",
"kind": "audio",
"timestamp": 1636808733258.573,
"totalAudioEnergy": 0,
"totalSamplesDuration": 90.08000000000918,
"trackIdentifier": "222a181f-d0fe-4434-b7a1-a8e05e3abbb4",
"type": "media-source"
}, ...
]
},
{
"channel_id": "zakuro",
"connection_id": "X019KW3ZT95WZ6T15S6HHTM59C",
"timestamp": "2021-11-13T13:05:44.044Z",
"rtc_stats": [
{
"audioLevel": 0,
"id": "RTCAudioSource_1",
"kind": "audio",
"timestamp": 1636808744029.488,
"totalAudioEnergy": 0,
"totalSamplesDuration": 31.070000000002057,
"trackIdentifier": "9a84b996-d3ab-4cea-8131-04f96232dde5",
"type": "media-source"
}, ...
]
}
]
ListChannelRtcStats¶
バージョン 2024.1.0 で追加。
- x-sora-target:
Sora_20211215.ListChannelRtcStats
指定したチャネルの RTC 統計情報の一覧を取得します。
キー |
型 |
|---|---|
channel_id |
string |
$ curl -sS \
-X POST \
http://127.0.0.1:3000/ \
-H "x-sora-target: Sora_20211215.ListChannelRtcStats" \
--json '{"channel_id":"sora"}' \
| jq .
[
{
"channel_id": "sora",
"connection_id": "1BW6V4P6A14MZ0W2HHXV3M8MCW",
"timestamp": "2021-11-13T13:10:25.736Z",
"rtc_stats": [
{
"audioLevel": 0,
"id": "RTCAudioSource_1",
"kind": "audio",
"timestamp": 1636809025720.942,
"totalAudioEnergy": 0,
"totalSamplesDuration": 90.08000000000918,
"trackIdentifier": "58c7f808-5b7f-4283-8816-0ac1f7d75387",
"type": "media-source"
}, ...
]
},
{
"channel_id": "sora",
"connection_id": "VDH8HN6X6S4MZF2FCQJF3Z4M8G",
"timestamp": "2021-11-13T13:10:30.643Z",
"rtc_stats": [
{
"audioLevel": 0,
"id": "RTCAudioSource_1",
"kind": "audio",
"timestamp": 1636809030622.809,
"totalAudioEnergy": 0,
"totalSamplesDuration": 91.08000000000968,
"trackIdentifier": "e6d3182d-706c-445f-9a91-c5951d55e000",
"type": "media-source"
}, ...
]
}
]
GetRtcStats¶
バージョン 2024.1.0 で追加。
- x-sora-target:
Sora_20211215.GetRtcStats
指定した接続の RTC 統計情報を取得します。
キー |
型 |
|---|---|
channel_id |
string |
connection_id |
string |
$ curl -sS \
-X POST \
http://127.0.0.1:3000/ \
-H "x-sora-target: Sora_20211215.GetRtcStats" \
--json '{"channel_id":"sora","connection_id":"VDH8HN6X6S4MZF2FCQJF3Z4M8G"}' \
| jq .
{
"channel_id": "sora",
"connection_id": "VDH8HN6X6S4MZF2FCQJF3Z4M8G",
"rtc_stats": [
{
"audioLevel": 0,
"id": "RTCAudioSource_1",
"kind": "audio",
"timestamp": 1636809090624.392,
"totalAudioEnergy": 0,
"totalSamplesDuration": 151.08000000000757,
"trackIdentifier": "e6d3182d-706c-445f-9a91-c5951d55e000",
"type": "media-source"
}, ...
],
"timestamp": "2021-11-13T13:11:30.647Z"
}