RTC 統計情報 API

注意

この API は 実験的機能 のため、正式版では仕様が変更される可能性があります。

統計情報更新のタイミングについて

この統計情報は、クライアントからシグナリングで送信されてくる統計情報の最新の値を返します。 デフォルトでは WebSocket と DataChannel 経由のどちらも 60 秒間隔で更新されます。

間隔は以下で変更できます。

ListRtcStats

x-sora-target:

Sora_20211215.ListRtcStats

すべてのユーザーエージェント統計情報の一覧を取得します。

キー

デフォルト

local (オプション)

boolean

true

local はクラスター機能利用時に、全てのノードの情報を取得するかどうかを指定します。

$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20211215.ListRtcStats -vvv
POST / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.4.0
x-sora-target: Sora_20211215.ListRtcStats



HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 30262
content-type: application/json
date: Sat, 13 Nov 2021 13:05:51 GMT
server: Cowboy

[
    {
        "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

x-sora-target:

Sora_20211215.ListChannelRtcStats

指定したチャネルのユーザーエージェント統計情報の一覧を取得します。

キー

channel_id

string

$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20211215.ListChannelRtcStats \
    channel_id=sora \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.4.0
x-sora-target: Sora_20211215.ListChannelRtcStats

{
    "channel_id": "sora"
}


HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 30368
content-type: application/json
date: Sat, 13 Nov 2021 13:10:35 GMT
server: Cowboy

[
    {
        "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

x-sora-target:

Sora_20211215.GetRtcStats

指定した接続のユーザーエージェント統計情報を取得します。

キー

channel_id

string

connection_id

string

$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20211215.GetRtcStats \
    channel_id=sora \
    connection_id=VDH8HN6X6S4MZF2FCQJF3Z4M8G \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 69
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.4.0
x-sora-target: Sora_20211215.GetRtcStats

{
    "channel_id": "sora",
    "connection_id": "VDH8HN6X6S4MZF2FCQJF3Z4M8G"
}


HTTP/1.1 200 OK
access-control-allow-headers: Origin, X-Requested-With, Content-Type, Accept, x-sora-target
access-control-allow-methods: POST, OPTIONS
access-control-allow-origin: http://127.0.0.1:5000
access-control-max-age: 1000
content-length: 15181
content-type: application/json
date: Sat, 13 Nov 2021 13:11:46 GMT
server: Cowboy

{
    "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"
}
© Copyright 2024, Shiguredo Inc Created using Sphinx 7.4.5