API

概要

API は Sora に対して HTTP 経由で実行できます。

API は DynamoDB や Route53 などの AWS API が独特な仕様なので紹介 を参考にしており、 x-sora-target というヘッダーを使って実行します。

全ての処理は POST であり PATH は / です。投げる Body は全て JSON を使用します。

設定

api_port

sys.config にて API のポート番号を設定してください。

{api_port, 3000}

api_cors_origin

API をクロスドメインで使用したい場合に設定します。

{api_cors_origin, "http://127.0.0.1:5000"}

こうすることで http://127.0.0.1:5000 から API を叩くことができるようになります。

httpie

ここでの例では httpie という Python のライブラリを使用しています。

シグナリング API

指定したチャネルの接続をすべて切断する

サービス

Sora

バージョン

20151104

オペレーション

DisconnectChannel

x-sora-target

Sora_20151104.DisconnectChannel

キー

channel_id

string

reason (オプション)

object

reason に値を指定した場合、イベントウェブフック connection.destroyed の reason に指定した値が入ってきます。

$ http POST 127.0.0.1:3000 \
    x-sora-target:Sora_20151104.DisconnectChannel \
    channel_id=sora \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.3
x-sora-target: Sora_20151104.DisconnectChannel

{
    "channel_id": "sora"
}

HTTP/1.1 200 OK
content-length: 0
content-type: application/json
date: Sun, 24 Jul 2016 06:04:53 GMT
server: Cowboy

指定したチャネルすべての配信者の接続を切断する

警告

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

サービス

Sora

バージョン

20151104

オペレーション

DisconnectChannelUpstream

x-sora-target

Sora_20151104.DisconnectChannelUpstream

キー

channel_id

string

reason (オプション)

object

reason に値を指定した場合、イベントウェブフック connection.destroyed の reason に指定した値が入ってきます。

$ http POST 127.0.0.1:3000 \
    x-sora-target:Sora_20151104.DisconnectChannelUpstream \
    channel_id=sora \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.3
x-sora-target: Sora_20151104.DisconnectChannelUpstream

{
    "channel_id": "sora"
}

HTTP/1.1 200 OK
content-length: 0
content-type: application/json
date: Sun, 24 Jul 2016 06:04:53 GMT
server: Cowboy

指定したチャネルすべての視聴者の接続を切断する

警告

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

サービス

Sora

バージョン

20151104

オペレーション

DisconnectChannelDownstream

x-sora-target

Sora_20151104.DisconnectChannelDownstream

キー

channel_id

string

reason (オプション)

object

reason に値を指定した場合、イベントウェブフック connection.destroyed の reason に指定した値が入ってきます。

$ http POST 127.0.0.1:3000 \
    x-sora-target:Sora_20151104.DisconnectChannelDownstream \
    channel_id=sora \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.3
x-sora-target: Sora_20151104.DisconnectChannelDownstream

{
    "channel_id": "sora"
}

HTTP/1.1 200 OK
content-length: 0
content-type: application/json
date: Sun, 24 Jul 2016 06:04:53 GMT
server: Cowboy

指定したクライアント ID の接続をすべて切断する

サービス

Sora

バージョン

20151104

オペレーション

DisconnectClient

x-sora-target

Sora_20151104.DisconnectClient

キー

channel_id

string

client_id

string

reason (オプション)

object

reason に値を指定した場合、イベントウェブフック connection.destroyed の reason に指定した値が入ってきます。

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20151104.DisconnectClient \
    channel_id=sora \
    client_id=d5339cd0-2d4c-4524-8103-7a70d3794a16 \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 75
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.3
x-sora-target: Sora_20151104.DisconnectClient

{
    "channel_id": "sora",
    "client_id": "d5339cd0-2d4c-4524-8103-7a70d3794a16"
}

HTTP/1.1 200 OK
content-length: 0
content-type: application/json
date: Sun, 29 May 2016 05:13:20 GMT
server: Cowboy

指定したコネクション ID の接続を切断する

サービス

Sora

バージョン

20151104

オペレーション

DisconnectConnection

x-sora-target

Sora_20151104.DisconnectConnection

キー

channel_id

string

connection_id

string

reason (オプション)

object

reason に値を指定した場合、イベントウェブフック connection.destroyed の reason に指定した値が入ってきます。

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20151104.DisconnectConnection \
    channel_id=sora \
    connection_id=d5339cd0-2d4c-4524-8103-7a70d3794a16 \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 75
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.3
x-sora-target: Sora_20151104.DisconnectConnection

{
    "channel_id": "sora",
    "connection_id": "d5339cd0-2d4c-4524-8103-7a70d3794a16"
}

HTTP/1.1 200 OK
content-length: 0
content-type: application/json
date: Sun, 29 May 2016 05:13:20 GMT
server: Cowboy

旧 API: 指定したクライアント ID の接続を切断する

重要

この API は後方互換性の維持のために残されています

警告

sys.config にて allow_client_id_assignment を true にしていた場合はこの API は利用できません

サービス

Sora

バージョン

20151104

オペレーション

Disconnect

x-sora-target

Sora_20151104.Disconnect

キー

channel_id

string

client_id

string

reason (オプション)

object

reason に値を指定した場合、イベントウェブフック connection.destroyed の reason に指定した値が入ってきます。

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20151104.Disconnect \
    channel_id=sora \
    client_id=d5339cd0-2d4c-4524-8103-7a70d3794a16 \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 75
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.3
x-sora-target: Sora_20151104.Disconnect

{
    "channel_id": "sora",
    "client_id": "d5339cd0-2d4c-4524-8103-7a70d3794a16"
}

HTTP/1.1 200 OK
content-length: 0
content-type: application/json
date: Sun, 29 May 2016 05:13:20 GMT
server: Cowboy

指定したチャネルの接続一覧を取得する

サービス

Sora

バージョン

20151104

オペレーション

ListConnections

x-sora-target

Sora_20151104.ListConnections

キー

channel_id

string

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20151104.ListConnections \
    channel_id=sora \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: sora-test.shiguredo.jp:3000
User-Agent: HTTPie/1.0.2
x-sora-target: Sora_20151104.ListConnections

{
    "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: 317
content-type: application/json
date: Tue, 16 Apr 2019 04:00:02 GMT
server: Cowboy

[
    {
        "channel_id": "sora",
        "client_id": "🥝🥝🥝🥝",
        "connection_id": "d39f0172-de73-44b2-82b2-04e9f450e634",
        "role": "upstream"
    },
    {
        "channel_id": "sora",
        "client_id": "🥝🥝🥝🥝",
        "connection_id": "bb7dd94b-efc7-4700-a45d-31e0c4b43abe",
        "role": "upstream"
    }
]

すべての接続一覧を取得する

サービス

Sora

バージョン

20151104

オペレーション

ListAllConnections

x-sora-target

Sora_20151104.ListAllConnections

レスポンス項目

リスト

  • role

  • channel_id

  • client_id

  • connection_id

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20151104.ListAllConnections \
    -vvv
http POST sora-test.shiguredo.jp:3000/ x-sora-target:Sora_20151104.ListAllConnections -vvv
POST / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 0
Host: sora-test.shiguredo.jp:3000
User-Agent: HTTPie/1.0.2
x-sora-target: Sora_20151104.ListAllConnections



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: 635
content-type: application/json
date: Tue, 16 Apr 2019 04:01:04 GMT
server: Cowboy

[
    {
        "channel_id": "sora",
        "client_id": "🥝🥝🥝🥝",
        "connection_id": "d39f0172-de73-44b2-82b2-04e9f450e634",
        "role": "upstream"
    },
    {
        "channel_id": "sora",
        "client_id": "🥝🥝🥝🥝",
        "connection_id": "bb7dd94b-efc7-4700-a45d-31e0c4b43abe",
        "role": "upstream"
    },
    {
        "channel_id": "sora2",
        "client_id": "🥝🥝🥝🥝",
        "connection_id": "ce77f023-bf93-4410-b00a-d9f722b78d17",
        "role": "upstream"
    },
    {
        "channel_id": "sora3",
        "client_id": "🥝🥝🥝🥝",
        "connection_id": "a57ea7fc-89c9-44a6-be42-9702491856bf",
        "role": "upstream"
    }
]

指定したチャネルのクライアント情報を取得する

サービス

Sora

バージョン

20170814

オペレーション

ListChannelClients

x-sora-target

Sora_20170814.ListChannelClients

キー

channel_id

string

レスポンス項目

リスト

  • role

  • multistream

  • channel_id

  • client_id

  • connection_id

  • audio

  • video

  • minutes

    • 分単位での接続経過時間

  • event_metadta

    • 認証時に認証サーバから指定した event_metadata

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20170814.ListChannelClients \
    channel_id=sora \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: sora-test.shiguredo.jp:3000
User-Agent: HTTPie/1.0.2
x-sora-target: Sora_20170814.ListChannelClients

{
    "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: 530
content-type: application/json
date: Tue, 16 Apr 2019 04:02:29 GMT
server: Cowboy

[
    {
        "audio": {
            "codec_type": "OPUS"
        },
        "channel_id": "sora",
        "client_id": "🥝🥝🥝🥝",
        "connection_id": "d39f0172-de73-44b2-82b2-04e9f450e634",
        "minutes": 10,
        "multistream": true,
        "role": "upstream",
        "video": {
            "bit_rate": 1000,
            "codec_type": "VP9"
        }
    },
    {
        "audio": {
            "codec_type": "OPUS"
        },
        "channel_id": "sora",
        "client_id": "🥝🥝🥝🥝",
        "connection_id": "bb7dd94b-efc7-4700-a45d-31e0c4b43abe",
        "minutes": 8,
        "multistream": true,
        "role": "upstream",
        "video": {
            "bit_rate": 1000,
            "codec_type": "VP9"
        }
    }
]

プッシュ API

シグナリングで使用している WebSocket を活用できる API です。この機能を使うことでアプリ側でプッシュの仕組みを用意する必要がなくなります。

指定したチャネル全員にプッシュ通知を送る

サービス

Sora

バージョン

20160711

オペレーション

PushChannel

x-sora-target

Sora_20160711.PushChannel

キー

channel_id

string

data

object

data には全員に通知する JSON を指定してください。 クライアントには data に指定した JSON が送られます。

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20160711.PushChannel \
    channel_id=sora \
    data:="{\"spam\": \"egg\"}" \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 47
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.4
x-sora-target: Sora_20160711.PushChannel

{
    "channel_id": "sora",
    "data": {
        "spam": "egg"
    }
}

HTTP/1.1 200 OK
content-length: 37
content-type: application/json
date: Sun, 24 Jul 2016 06:26:21 GMT
server: Cowboy

{
    "data": {
        "spam": "egg"
    },
    "type": "push"
}

指定したチャネルのクライアントにプッシュ通知を送る

サービス

Sora

バージョン

20160711

オペレーション

PushClient

x-sora-target

Sora_20160711.PushClient

キー

channel_id

string

client_id

string

data

object

複数の接続に同一の client_id が指定されていた場合、複数の接続にプッシュ通知が送られます。

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20160711.PushClient \
    channel_id=sora \
    client_id=0a3313e2-7666-4d54-a301-4866b07bb93c \
    data:="{\"spam\": \"egg\"}" \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 100
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.4
x-sora-target: Sora_20160711.PushClient

{
    "channel_id": "sora",
    "client_id": "0a3313e2-7666-4d54-a301-4866b07bb93c",
    "data": {
        "spam": "egg"
    }
}

HTTP/1.1 200 OK
content-length: 37
content-type: application/json
date: Sun, 24 Jul 2016 07:46:31 GMT
server: Cowboy

{
    "data": {
        "spam": "egg"
    },
    "type": "push"
}

指定したチャネルの接続にプッシュ通知を送る

サービス

Sora

バージョン

20160711

オペレーション

PushConnection

x-sora-target

Sora_20160711.PushConnection

キー

channel_id

string

connection_id

string

data

object

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20160711.PushConnection \
    channel_id=sora \
    connection_id=0a3313e2-7666-4d54-a301-4866b07bb93c \
    data:="{\"spam\": \"egg\"}" \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 100
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.4
x-sora-target: Sora_20160711.PushConnection

{
    "channel_id": "sora",
    "client_id": "0a3313e2-7666-4d54-a301-4866b07bb93c",
    "data": {
        "spam": "egg"
    }
}

HTTP/1.1 200 OK
content-length: 37
content-type: application/json
date: Sun, 24 Jul 2016 07:46:31 GMT
server: Cowboy

{
    "data": {
        "spam": "egg"
    },
    "type": "push"
}

指定したチャネルの配信クライアントにプッシュ通知を送る

サービス

Sora

バージョン

20160711

オペレーション

PushUpstream

x-sora-target

Sora_20160711.PushUpstream

キー

channel_id

string

data

object

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20160711.PushUpstream \
    channel_id=sora \
    data:="{\"spam\": \"egg\"}" \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 47
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.4
x-sora-target: Sora_20160711.PushUpstream

{
    "channel_id": "sora",
    "data": {
        "spam": "egg"
    }
}

HTTP/1.1 200 OK
content-length: 37
content-type: application/json
date: Sun, 24 Jul 2016 06:29:08 GMT
server: Cowboy

{
    "data": {
        "spam": "egg"
    },
    "type": "push"
}

指定したチャネルの視聴クライアントにプッシュ通知を送る

サービス

Sora

バージョン

20160711

オペレーション

PushDownstream

x-sora-target

Sora_20160711.PushDownStream

キー

channel_id

string

data

object

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20160711.PushDownstream \
    channel_id=sora \
    data:="{\"spam\": \"egg\"}" \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 47
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.4
x-sora-target: Sora_20160711.PushDownstream

{
    "channel_id": "sora",
    "data": {
        "spam": "egg"
    }
}

HTTP/1.1 200 OK
content-length: 37
content-type: application/json
date: Sun, 24 Jul 2016 06:29:20 GMT
server: Cowboy

{
    "data": {
        "spam": "egg"
    },
    "type": "push"
}

録画 API

録画されたファイルは sys.config の archive_dir に指定したフォルダに置かれます。

録画可能な組み合わせ

映像コーデック

音声コーデック

出力形式

VP8

false

webm

VP9

false

webm

H.264

false

webm

VP8

Opus

webm

VP9

Opus

webm

H.264

Opus

webm

false

Opus

webm

false

PCMU

wav

映像コーデックの指定はシグナリング開始時に指定してください。

指定したチャネルの録画を開始する

サービス

Sora

バージョン

20161101

オペレーション

StartRecording

x-sora-target

Sora_20161101.StartRecording

キー

channel_id

string

expire_time

integer

  • start_time は録画を開始した時間で Unix Time (UTC) の秒数で返ってきます

  • expire_time を 0 に指定した場合、録画の期限が無くなります

  • expire_time の範囲は 0 から 86400 までで、秒数を指定してください

expire_time が 0:

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20161101.StartRecording \
    channel_id=sora \
    expire_time:=0 \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 41
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.9
x-sora-target: Sora_20161101.StartRecording

{
    "channel_id": "sora",
    "expire_time": 0
}

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: 82
content-type: application/json
date: Wed, 19 Apr 2017 06:35:38 GMT
server: Cowboy

{
    "channel_id": "sora",
    "expire_time": 0,
    "id": "77b83ad8-48d8-4323-9c56-30cedb716e60"
}

expire_time が 3600:

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20161101.StartRecording \
    channel_id=sora \
    expire_time:=3600 \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 43
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.9
x-sora-target: Sora_20161101.StartRecording

{
    "channel_id": "sora",
    "expire_time": 3600
}

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: 84
content-type: application/json
date: Wed, 19 Apr 2017 06:37:08 GMT
server: Cowboy

{
    "channel_id": "sora",
    "expire_time": 3600,
    "id": "bb55eb3d-feef-4983-a7c2-8be8664d1d04"
}

エラー

すでに録画が開始している場合は "STARTED-RECORDING" が返ってきます。

$ http POST 127.0.0.1:3000/ \
        x-sora-target:Sora_20161101.StartRecording \
        channel_id=sora \
        expire_time:=3600 \
        -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 43
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.9
x-sora-target: Sora_20161101.StartRecording

{
    "channel_id": "sora",
    "expire_time": 3600
}

HTTP/1.1 400 Bad Request
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: 34
content-type: application/json
date: Wed, 19 Apr 2017 06:44:58 GMT
server: Cowboy

{
    "error_type": "STARTED-RECORDING"
}
  • "STARTED-RECORDING"

    • すでに指定したチャネルでは録画が開始されている

指定したチャネルの録画を停止する

サービス

Sora

バージョン

20161101

オペレーション

StopRecording

x-sora-target

Sora_20161101.StopRecording

キー

channel_id

string

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20161101.StopRecording \
    channel_id=sora \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.4
x-sora-target: Sora_20161101.StopRecording

{
    "channel_id": "sora"
}

HTTP/1.1 200 OK
content-length: 21
content-type: application/json
date: Fri, 11 Nov 2016 14:29:14 GMT
server: Cowboy

{
    "channel_id": "sora"
}

エラー

  • NOT-STARTED-RECORDING

    • 指定したチャネルの録画が開始されていない

録画が有効かどうかを確認する

サービス

Sora

バージョン

20161101

オペレーション

GetStartedRecording

x-sora-target

Sora_20161101.GetStartedRecording

キー

channel_id

string

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20161101.GetStartedRecording \
    channel_id=sora \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.4
x-sora-target: Sora_20161101.GetStartedRecording

{
    "channel_id": "sora"
}

HTTP/1.1 200 OK
content-length: 88
content-type: application/json
date: Sat, 19 Nov 2016 13:03:24 GMT
server: Cowboy

{
    "channel_id": "sora",
    "expire_time": 3600,
    "expired_at": 1479563964,
    "start_time": 1479560364
}

エラー

指定したチャネルで録画が開始されていない場合は "NOT-STARTED-RECORDING" が返ってきます

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20161101.GetStartedRecording \
    channel_id=sora \
    -vvv
POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.4
x-sora-target: Sora_20161101.GetStartedRecording

{
    "channel_id": "sora"
}

HTTP/1.1 400 Bad Request
content-length: 38
content-type: application/json
date: Sat, 19 Nov 2016 13:03:53 GMT
server: Cowboy

{
    "error_type": "NOT-STARTED-RECORDING"
}
  • NOT-STARTED-RECORDING

    • 指定したチャネルの録画が開始されていない

録画が行われているチャネル一覧を取得する

サービス

Sora

バージョン

20161101

オペレーション

ListStartedRecording

x-sora-target

Sora_20161101.ListStartedRecording

$ http POST 127.0.0.1:3000/ \
    "x-sora-target:Sora_20161101.ListStartedRecording" \
    -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/0.9.4
x-sora-target: Sora_20161101.ListStartedRecording



HTTP/1.1 200 OK
content-length: 168
content-type: application/json
date: Sat, 19 Nov 2016 13:05:38 GMT
server: Cowboy

[
    {
        "channel_id": "sora",
        "expire_time": 3600,
        "expired_at": 1479564309,
        "start_time": 1479560709
    },
    {
        "channel_id": "akane",
        "expire_time": 0,
        "expired_at": 0,
        "start_time": 1479560735
    }
]

現在録画中の状態を取得する

サービス

Sora

バージョン

20161101

オペレーション

ListArchiving

x-sora-target

Sora_20161101.ListArchiving

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20161101.ListArchiving \
    -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/1.0.2
x-sora-target: Sora_20161101.ListArchiving



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: 218
content-type: application/json
date: Mon, 15 Apr 2019 08:39:20 GMT
server: Cowboy

[
    {
        "audio": {
            "codec_type": "OPUS"
        },
        "channel_id": "sora",
        "client_id": "1a87f50d-5933-4c37-83d8-0339f023fdbe",
        "connection_id": "1a87f50d-5933-4c37-83d8-0339f023fdbe",
        "seconds": 146,
        "video": {
            "bit_rate": 1000,
            "codec_type": "VP9"
        }
    }
]
  • seconds は録画を開始してからの経過時間(秒)です

  • video が設定されていない場合は "video": false という値が入ってきます

  • audio が設定されていない場合は "audio": false という値が入ってきます

RTP 転送 API

警告

RTP 転送機能は実験的機能のため正式版では仕様が変更される可能性があります

指定したチャネル ID の配信している映像または音声の RTP を指定した IP アドレスとポートに送信します。

指定したチャネルの RTP を転送を開始する

サービス

Sora

バージョン

20170814

オペレーション

StartForwardingRtp

x-sora-target

Sora_20170814.StartForwardingRtp

キー

channel_id

string

client_id (オプション)

string

connection_id (オプション)

string

ip_address

string

audio_port

integer

video_port

integer

マルチストリームの音声や映像を転送する場合は client_id または connection_id を指定してください。

sys.config にて allow_client_id_assignmenttrue にしていた場合は client_id は指定できなくなります。

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20170814.StartForwardingRtp \
    channel_id=sora \
    ip_address=127.0.0.1 \
    audio_port:=60001 \
    video_port:=60003 \
    -vvv

POST / HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 93
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.2
x-sora-target: Sora_20170814.StartForwardingRtp

{
    "audio_port": 60001,
    "channel_id": "sora",
    "ip_address": "127.0.0.1",
    "video_port": 60003
}

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: 262
content-type: application/json
date: Wed, 30 Aug 2017 02:08:50 GMT
server: Cowboy

{
    "sdp": "v=0\r\no=- 0 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\nm=audio 60001 RTP/SAVPF 109\r\nc=IN IP4 127.0.0.1\r\na=rtpmap:109 opus/48000/2\r\nm=video 60003 RTP/SAVPF 120\r\nc=IN IP4 127.0.0.1\r\na=rtpmap:120 VP9/90000\r\na=fmtp:120 max-fs=12288;max-fr=60\r\n"
}

指定したチャネルの RTP を転送を停止する

サービス

Sora

バージョン

20170814

オペレーション

StopForwardingRtp

x-sora-target

Sora_20170814.StopForwardingRtp

キー

channel_id

string

client_id (オプション)

string

connection_id (オプション)

string

マルチストリームの音声や映像の転送を停止する場合は client_id または connection_id を指定してください。

sys.config にて allow_client_id_assignmenttrue にしていた場合は client_id は指定できなくなります。

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20170814.StopForwardingRtp \
    channel_id=sora \
    -vvv

POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 22
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.9
x-sora-target: Sora_20170814.StopForwardingRtp

{
    "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: 21
content-type: application/json
date: Fri, 25 Aug 2017 13:32:48 GMT
server: Cowboy

{
    "channel_id": "sora"
}

統計 API

指定したクライアントの統計情報を取得する

サービス

Sora

バージョン

20170529

オペレーション

GetStatsClient

x-sora-target

Sora_20170529.GetStatsClient

キー

channel_id

string

client_id

string

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20170529.GetStatsClient \
    channel_id=sora \
    client_id=418aa2ed-9a52-4fe5-b044-3a8e736dc94b \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 75
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/1.0.2
x-sora-target: Sora_20170529.GetStatsClient

{
    "channel_id": "sora",
    "client_id": "418aa2ed-9a52-4fe5-b044-3a8e736dc94b"
}

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: 2293
content-type: application/json
date: Mon, 15 Apr 2019 08:25:16 GMT
server: Cowboy

[
    {
        "channel_id": "sora",
        "client_id": "418aa2ed-9a52-4fe5-b044-3a8e736dc94b",
        "connection_id": "418aa2ed-9a52-4fe5-b044-3a8e736dc94b",
        "rtp": {
            "total_received": 45503,
            "total_received_byte_size": 34043098,
            "total_received_rtcp": 1137,
            "total_received_rtcp_bye": 0,
            "total_received_rtcp_byte_size": 64806,
            "total_received_rtcp_psfb_afb": 0,
            "total_received_rtcp_psfb_fir": 0,
            "total_received_rtcp_psfb_pli": 0,
            "total_received_rtcp_rr": 308,
            "total_received_rtcp_rtpfb_generic_nack": 0,
            "total_received_rtcp_rtpfb_tmmbn": 0,
            "total_received_rtcp_rtpfb_tmmbr": 0,
            "total_received_rtcp_rtpfb_transport_wide": 0,
            "total_received_rtcp_sdes": 829,
            "total_received_rtcp_sr": 829,
            "total_received_rtcp_unknown": 0,
            "total_received_rtcp_xr": 0,
            "total_received_rtp": 44366,
            "total_received_rtp_byte_size": 33978292,
            "total_sent": 10071,
            "total_sent_byte_size": 355194,
            "total_sent_rtcp": 10071,
            "total_sent_rtcp_bye": 0,
            "total_sent_rtcp_byte_size": 355194,
            "total_sent_rtcp_psfb_afb": 505,
            "total_sent_rtcp_psfb_fir": 0,
            "total_sent_rtcp_psfb_pli": 10,
            "total_sent_rtcp_rr": 505,
            "total_sent_rtcp_rtpfb_generic_nack": 9556,
            "total_sent_rtcp_rtpfb_tmmbn": 0,
            "total_sent_rtcp_rtpfb_tmmbr": 0,
            "total_sent_rtcp_rtpfb_transport_wide": 0,
            "total_sent_rtcp_sdes": 0,
            "total_sent_rtcp_sr": 0,
            "total_sent_rtcp_unknown": 0,
            "total_sent_rtcp_xr": 0,
            "total_sent_rtp": 0,
            "total_sent_rtp_byte_size": 0
        },
        "timestamp": "2019-04-15T08:25:17Z",
        "turn": {
            "total_received_allocate_request": 3,
            "total_received_binding_request": 0,
            "total_received_channel_bind_request": 2,
            "total_received_channel_data": 50516,
            "total_received_create_permission_request": 2,
            "total_received_refresh_request": 1,
            "total_received_send_indication": 2,
            "total_received_turn_binding_error": 0,
            "total_received_turn_binding_request": 104,
            "total_received_turn_binding_success": 1,
            "total_received_turn_unknown": 0,
            "total_sent_allocate_error": 1,
            "total_sent_allocate_success": 1,
            "total_sent_binding_error": 0,
            "total_sent_binding_success": 0,
            "total_sent_channel_bind_error": 0,
            "total_sent_channel_bind_success": 2,
            "total_sent_channel_data": 10178,
            "total_sent_create_permission_error": 0,
            "total_sent_create_permission_success": 2,
            "total_sent_data_indication": 1,
            "total_sent_refresh_error": 0,
            "total_sent_refresh_success": 1,
            "total_sent_turn_binding_error": 0,
            "total_sent_turn_binding_request": 0,
            "total_sent_turn_binding_success": 104,
            "total_sent_turn_unknown": 0
        }
    }
]

指定した接続の統計情報を取得する

サービス

Sora

バージョン

20170529

オペレーション

GetStatsConnection

x-sora-target

Sora_20170529.GetStatsConnection

キー

channel_id

string

connection_id

string

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20170529.GetStatsConnection \
    channel_id=sora \
    connection_id=418aa2ed-9a52-4fe5-b044-3a8e736dc94b \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 75
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/1.0.2
x-sora-target: Sora_20170529.GetStatsConnection

{
    "channel_id": "sora",
    "connection_id": "418aa2ed-9a52-4fe5-b044-3a8e736dc94b"
}

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: 2293
content-type: application/json
date: Mon, 15 Apr 2019 08:25:16 GMT
server: Cowboy

{
    "channel_id": "sora",
    "client_id": "418aa2ed-9a52-4fe5-b044-3a8e736dc94b",
    "connection_id": "418aa2ed-9a52-4fe5-b044-3a8e736dc94b",
    "rtp": {
        "total_received": 45503,
        "total_received_byte_size": 34043098,
        "total_received_rtcp": 1137,
        "total_received_rtcp_bye": 0,
        "total_received_rtcp_byte_size": 64806,
        "total_received_rtcp_psfb_afb": 0,
        "total_received_rtcp_psfb_fir": 0,
        "total_received_rtcp_psfb_pli": 0,
        "total_received_rtcp_rr": 308,
        "total_received_rtcp_rtpfb_generic_nack": 0,
        "total_received_rtcp_rtpfb_tmmbn": 0,
        "total_received_rtcp_rtpfb_tmmbr": 0,
        "total_received_rtcp_rtpfb_transport_wide": 0,
        "total_received_rtcp_sdes": 829,
        "total_received_rtcp_sr": 829,
        "total_received_rtcp_unknown": 0,
        "total_received_rtcp_xr": 0,
        "total_received_rtp": 44366,
        "total_received_rtp_byte_size": 33978292,
        "total_sent": 10071,
        "total_sent_byte_size": 355194,
        "total_sent_rtcp": 10071,
        "total_sent_rtcp_bye": 0,
        "total_sent_rtcp_byte_size": 355194,
        "total_sent_rtcp_psfb_afb": 505,
        "total_sent_rtcp_psfb_fir": 0,
        "total_sent_rtcp_psfb_pli": 10,
        "total_sent_rtcp_rr": 505,
        "total_sent_rtcp_rtpfb_generic_nack": 9556,
        "total_sent_rtcp_rtpfb_tmmbn": 0,
        "total_sent_rtcp_rtpfb_tmmbr": 0,
        "total_sent_rtcp_rtpfb_transport_wide": 0,
        "total_sent_rtcp_sdes": 0,
        "total_sent_rtcp_sr": 0,
        "total_sent_rtcp_unknown": 0,
        "total_sent_rtcp_xr": 0,
        "total_sent_rtp": 0,
        "total_sent_rtp_byte_size": 0
    },
    "timestamp": "2019-04-15T08:25:17Z",
    "turn": {
        "total_received_allocate_request": 3,
        "total_received_binding_request": 0,
        "total_received_channel_bind_request": 2,
        "total_received_channel_data": 50516,
        "total_received_create_permission_request": 2,
        "total_received_refresh_request": 1,
        "total_received_send_indication": 2,
        "total_received_turn_binding_error": 0,
        "total_received_turn_binding_request": 104,
        "total_received_turn_binding_success": 1,
        "total_received_turn_unknown": 0,
        "total_sent_allocate_error": 1,
        "total_sent_allocate_success": 1,
        "total_sent_binding_error": 0,
        "total_sent_binding_success": 0,
        "total_sent_channel_bind_error": 0,
        "total_sent_channel_bind_success": 2,
        "total_sent_channel_data": 10178,
        "total_sent_create_permission_error": 0,
        "total_sent_create_permission_success": 2,
        "total_sent_data_indication": 1,
        "total_sent_refresh_error": 0,
        "total_sent_refresh_success": 1,
        "total_sent_turn_binding_error": 0,
        "total_sent_turn_binding_request": 0,
        "total_sent_turn_binding_success": 104,
        "total_sent_turn_unknown": 0
    }
}

旧 API: 指定したクライアントの統計情報を取得する

重要

この API は後方互換性の維持のために残されています

警告

sys.config にて allow_client_id_assignment を true にしていた場合はこの API は利用できません

サービス

Sora

バージョン

20170529

オペレーション

GetStats

x-sora-target

Sora_20170529.GetStats

キー

channel_id

string

client_id

string

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20170529.GetStats \
    channel_id=sora \
    client_id=418aa2ed-9a52-4fe5-b044-3a8e736dc94b \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 75
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/1.0.2
x-sora-target: Sora_20170529.GetStats

{
    "channel_id": "sora",
    "client_id": "418aa2ed-9a52-4fe5-b044-3a8e736dc94b"
}

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: 2293
content-type: application/json
date: Mon, 15 Apr 2019 08:25:16 GMT
server: Cowboy

{
    "channel_id": "sora",
    "client_id": "418aa2ed-9a52-4fe5-b044-3a8e736dc94b",
    "connection_id": "418aa2ed-9a52-4fe5-b044-3a8e736dc94b",
    "rtp": {
        "total_received": 45503,
        "total_received_byte_size": 34043098,
        "total_received_rtcp": 1137,
        "total_received_rtcp_bye": 0,
        "total_received_rtcp_byte_size": 64806,
        "total_received_rtcp_psfb_afb": 0,
        "total_received_rtcp_psfb_fir": 0,
        "total_received_rtcp_psfb_pli": 0,
        "total_received_rtcp_rr": 308,
        "total_received_rtcp_rtpfb_generic_nack": 0,
        "total_received_rtcp_rtpfb_tmmbn": 0,
        "total_received_rtcp_rtpfb_tmmbr": 0,
        "total_received_rtcp_rtpfb_transport_wide": 0,
        "total_received_rtcp_sdes": 829,
        "total_received_rtcp_sr": 829,
        "total_received_rtcp_unknown": 0,
        "total_received_rtcp_xr": 0,
        "total_received_rtp": 44366,
        "total_received_rtp_byte_size": 33978292,
        "total_sent": 10071,
        "total_sent_byte_size": 355194,
        "total_sent_rtcp": 10071,
        "total_sent_rtcp_bye": 0,
        "total_sent_rtcp_byte_size": 355194,
        "total_sent_rtcp_psfb_afb": 505,
        "total_sent_rtcp_psfb_fir": 0,
        "total_sent_rtcp_psfb_pli": 10,
        "total_sent_rtcp_rr": 505,
        "total_sent_rtcp_rtpfb_generic_nack": 9556,
        "total_sent_rtcp_rtpfb_tmmbn": 0,
        "total_sent_rtcp_rtpfb_tmmbr": 0,
        "total_sent_rtcp_rtpfb_transport_wide": 0,
        "total_sent_rtcp_sdes": 0,
        "total_sent_rtcp_sr": 0,
        "total_sent_rtcp_unknown": 0,
        "total_sent_rtcp_xr": 0,
        "total_sent_rtp": 0,
        "total_sent_rtp_byte_size": 0
    },
    "timestamp": "2019-04-15T08:25:17Z",
    "turn": {
        "total_received_allocate_request": 3,
        "total_received_binding_request": 0,
        "total_received_channel_bind_request": 2,
        "total_received_channel_data": 50516,
        "total_received_create_permission_request": 2,
        "total_received_refresh_request": 1,
        "total_received_send_indication": 2,
        "total_received_turn_binding_error": 0,
        "total_received_turn_binding_request": 104,
        "total_received_turn_binding_success": 1,
        "total_received_turn_unknown": 0,
        "total_sent_allocate_error": 1,
        "total_sent_allocate_success": 1,
        "total_sent_binding_error": 0,
        "total_sent_binding_success": 0,
        "total_sent_channel_bind_error": 0,
        "total_sent_channel_bind_success": 2,
        "total_sent_channel_data": 10178,
        "total_sent_create_permission_error": 0,
        "total_sent_create_permission_success": 2,
        "total_sent_data_indication": 1,
        "total_sent_refresh_error": 0,
        "total_sent_refresh_success": 1,
        "total_sent_turn_binding_error": 0,
        "total_sent_turn_binding_request": 0,
        "total_sent_turn_binding_success": 104,
        "total_sent_turn_unknown": 0
    }
}

すべての接続の統計情報を取得する

サービス

Sora

バージョン

20171101

オペレーション

GetStatsAllConnections

x-sora-target

Sora_20171101.GetStatsAllConnections

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20171101.GetStatsAllConnections -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/1.0.2
x-sora-target: Sora_20171101.GetStatsAllConnections



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: 4344
content-type: application/json
date: Fri, 11 Jan 2019 06:41:17 GMT
server: Cowboy

[
    {
        "channel_id": "sora",
        "client_id": "e1ea4986-cd6e-496c-be71-5015014ea77f",
        "connection_id": "e1ea4986-cd6e-496c-be71-5015014ea77f",
        "rtp": {
            "total_received_byte_size": 8489011,
            "total_received": 13951,
            "total_received_rtcp": 331,
            "total_received_rtcp_bye": 0,
            "total_received_rtcp_byte_size": 16114,
            "total_received_rtcp_psfb_afb": 0,
            "total_received_rtcp_psfb_fir": 0,
            "total_received_rtcp_psfb_pli": 0,
            "total_received_rtcp_rr": 147,
            "total_received_rtcp_rtpfb_generic_nack": 0,
            "total_received_rtcp_rtpfb_tmmbn": 0,
            "total_received_rtcp_rtpfb_tmmbr": 0,
            "total_received_rtcp_rtpfb_transport_wide": 0,
            "total_received_rtcp_sdes": 184,
            "total_received_rtcp_sr": 184,
            "total_received_rtcp_unknown": 0,
            "total_received_rtcp_xr": 0,
            "total_received_rtp": 13620,
            "total_received_rtp_byte_size": 8472897,
            "total_sent_byte_size": 16072,
            "total_sent": 234,
            "total_sent_rtcp": 234,
            "total_sent_rtcp_bye": 0,
            "total_sent_rtcp_byte_size": 16072,
            "total_sent_rtcp_psfb_afb": 227,
            "total_sent_rtcp_psfb_fir": 0,
            "total_sent_rtcp_psfb_pli": 7,
            "total_sent_rtcp_rr": 227,
            "total_sent_rtcp_rtpfb_generic_nack": 0,
            "total_sent_rtcp_rtpfb_tmmbn": 0,
            "total_sent_rtcp_rtpfb_tmmbr": 0,
            "total_sent_rtcp_rtpfb_transport_wide": 0,
            "total_sent_rtcp_sdes": 0,
            "total_sent_rtcp_sr": 0,
            "total_sent_rtcp_unknown": 0,
            "total_sent_rtcp_xr": 0,
            "total_sent_rtp": 0,
            "total_sent_rtp_byte_size": 0
        },
        "timestamp": "2019-01-11T06:41:18Z",
        "turn": {
            "total_received_allocate_request": 1,
            "total_received_binding_request": 0,
            "total_received_channel_bind_request": 1,
            "total_received_channel_data": 14023,
            "total_received_create_permission_request": 1,
            "total_received_refresh_request": 0,
            "total_received_send_indication": 2,
            "total_received_turn_binding_error": 0,
            "total_received_turn_binding_request": 0,
            "total_received_turn_binding_success": 0,
            "total_received_turn_unknown": 0,
            "total_sent_allocate_error": 0,
            "total_sent_allocate_success": 0,
            "total_sent_binding_error": 0,
            "total_sent_binding_success": 0,
            "total_sent_channel_bind_error": 0,
            "total_sent_channel_bind_success": 1,
            "total_sent_channel_data": 236,
            "total_sent_create_permission_error": 0,
            "total_sent_create_permission_success": 1,
            "total_sent_data_indication": 1,
            "total_sent_refresh_error": 0,
            "total_sent_refresh_success": 0,
            "total_sent_turn_binding_error": 0,
            "total_sent_turn_binding_request": 0,
            "total_sent_turn_binding_success": 0,
            "total_sent_turn_unknown": 0
        }
    },
    {
        "channel_id": "sora",
        "client_id": "895f0755-3562-4ccf-89bc-b75062af1a89",
        "connection_id": "895f0755-3562-4ccf-89bc-b75062af1a89",
        "rtp": {
            "total_received_byte_size": 6110,
            "total_received": 89,
            "total_received_rtcp": 89,
            "total_received_rtcp_bye": 0,
            "total_received_rtcp_byte_size": 6110,
            "total_received_rtcp_psfb_afb": 84,
            "total_received_rtcp_psfb_fir": 0,
            "total_received_rtcp_psfb_pli": 0,
            "total_received_rtcp_rr": 89,
            "total_received_rtcp_rtpfb_generic_nack": 0,
            "total_received_rtcp_rtpfb_tmmbn": 0,
            "total_received_rtcp_rtpfb_tmmbr": 0,
            "total_received_rtcp_rtpfb_transport_wide": 0,
            "total_received_rtcp_sdes": 0,
            "total_received_rtcp_sr": 0,
            "total_received_rtcp_unknown": 0,
            "total_received_rtcp_xr": 0,
            "total_received_rtp": 0,
            "total_received_rtp_byte_size": 0,
            "total_sent_byte_size": 1399568,
            "total_sent": 2265,
            "total_sent_rtcp": 34,
            "total_sent_rtcp_bye": 0,
            "total_sent_rtcp_byte_size": 3060,
            "total_sent_rtcp_psfb_afb": 0,
            "total_sent_rtcp_psfb_fir": 0,
            "total_sent_rtcp_psfb_pli": 0,
            "total_sent_rtcp_rr": 0,
            "total_sent_rtcp_rtpfb_generic_nack": 0,
            "total_sent_rtcp_rtpfb_tmmbn": 0,
            "total_sent_rtcp_rtpfb_tmmbr": 0,
            "total_sent_rtcp_rtpfb_transport_wide": 0,
            "total_sent_rtcp_sdes": 34,
            "total_sent_rtcp_sr": 34,
            "total_sent_rtcp_unknown": 0,
            "total_sent_rtcp_xr": 0,
            "total_sent_rtp": 2231,
            "total_sent_rtp_byte_size": 1396508
        },
        "timestamp": "2019-01-11T06:41:18Z",
        "turn": {
            "total_received_allocate_request": 1,
            "total_received_binding_request": 0,
            "total_received_channel_bind_request": 1,
            "total_received_channel_data": 104,
            "total_received_create_permission_request": 1,
            "total_received_refresh_request": 0,
            "total_received_send_indication": 2,
            "total_received_turn_binding_error": 0,
            "total_received_turn_binding_request": 0,
            "total_received_turn_binding_success": 0,
            "total_received_turn_unknown": 0,
            "total_sent_allocate_error": 0,
            "total_sent_allocate_success": 0,
            "total_sent_binding_error": 0,
            "total_sent_binding_success": 0,
            "total_sent_channel_bind_error": 0,
            "total_sent_channel_bind_success": 1,
            "total_sent_channel_data": 2267,
            "total_sent_create_permission_error": 0,
            "total_sent_create_permission_success": 1,
            "total_sent_data_indication": 1,
            "total_sent_refresh_error": 0,
            "total_sent_refresh_success": 0,
            "total_sent_turn_binding_error": 0,
            "total_sent_turn_binding_request": 0,
            "total_sent_turn_binding_success": 0,
            "total_sent_turn_unknown": 0
        }
    }
]

統計情報を取得する

サービス

Sora

バージョン

20171010

オペレーション

GetStatsReport

x-sora-target

Sora_20171010.GetStatsReport

Sora の起動している間の統計情報を取得することができます。この統計情報は Sora を止めたり再起動したりすることでクリアされますので注意してください。

レスポンス項目

  • total_successful_connections

    • 現在までの接続が成功した数

  • total_ongoing_connections

    • 現在接続している数

  • total_failed_connections

    • 現在までの接続が失敗した数

  • total_duration_sec

    • 現在までの合計接続時間 (秒)

  • total_turn_udp_connections

    • 現在までの TURN-UDP での接続数

  • total_turn_tcp_connections

    • 現在までの TURN-TCP または TURN-TLS での接続数

  • average_duration_sec

    • 平均接続時間 (秒)

  • average_setup_time_msec

    • 平均セットアップ時間 (ミリ秒)

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20171010.GetStatsReport \
    -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/0.9.9
x-sora-target: Sora_20171010.GetStatsReport



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: 172
content-type: application/json
date: Tue, 10 Oct 2017 10:23:22 GMT
server: Cowboy

{
    "average_duration_sec": 24,
    "average_setup_time_msec": 77,
    "total_duration_sec": 48,
    "total_failed_connections": 0,
    "total_ongoing_connections": 1,
    "total_successful_connections": 3,
    "total_turn_udp_connections": 2,
    "total_turn_tcp_connections": 1
}

ライセンス API

現在利用しているライセンス情報を取得する

サービス

Sora

バージョン

20171218

オペレーション

GetLicense

x-sora-target

Sora_20171218.GetLicense

$ http POST 127.0.0.1:3000/
    x-sora-target:Sora_20171218.GetLicense -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/0.9.9
x-sora-target: Sora_20171218.GetLicense



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: 174
content-type: application/json
date: Fri, 05 Jan 2018 06:41:35 GMT
server: Cowboy

{
    "max_connections": 100,
    "product_name": "Sora",
    "serial_code": "123ABC-SRA-E001-20180101-100",
    "type": "Experimental"
}

ライセンスを更新する

サービス

Sora

バージョン

20171218

オペレーション

UpdateLicense

x-sora-target

Sora_20171218.UpdateLicense

sys.config の license_file に設定したファイルを新規のライセンスとして読み込みます。ライセンスが壊れていたり、見つからない場合はエラーになります

$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20171218.UpdateLicense -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/0.9.9
x-sora-target: Sora_20171218.UpdateLicense



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: 379
content-type: application/json
date: Fri, 05 Jan 2018 06:44:47 GMT
server: Cowboy

{
    "new_license": {
        "max_connections": 100,
        "product_name": "Sora",
        "serial_code": "123ABC-SRA-E001-20180101-100",
        "type": "Experimental"
    },
    "old_license": {
        "max_connections": 100,
        "product_name": "Sora",
        "serial_code": "123ABC-SRA-E002-20190101-100",
        "type": "Experimental"
    }
}

スポットライト API

警告

スポットライト機能は実験的機能のため正式版では仕様が変更される可能性があります

指定した参加者を強制的に画面に表示する

サービス

Sora

バージョン

20180404

オペレーション

CastSpotlight

x-sora-target

Sora_20180404.CastSpotlight

キー

channel_id

string

connection_id

string

$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20180404.CastSpotlight \
                            channel_id=sora \
                            connection_id=ad31f60c-73e9-4a0b-a4ee-1de001174004 \
                            -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 75
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.9
x-sora-target: Sora_20180404.CastSpotlight

{
    "channel_id": "sora",
    "connection_id": "ad31f60c-73e9-4a0b-a4ee-1de001174004"
}

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: 72
content-type: application/json
date: Fri, 27 Apr 2018 02:01:35 GMT
server: Cowboy

{
    "channel_id": "sora",
    "connection_id": "ad31f60c-73e9-4a0b-a4ee-1de001174004"
}

指定した参加者を常に画面に表示する

サービス

Sora

バージョン

20180404

オペレーション

CastAlwaysSpotlight

x-sora-target

Sora_20180404.CastAlwaysSpotlight

キー

channel_id

string

connection_id

string

spotlight_id (オプション)

string

spotlight_id を指定しない場合はどこかのスポットライトに入ります。

$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20180404.CastAlwaysSpotlight \
                            channel_id=sora \
                            connection_id=af9103b1-2412-4a3c-88b2-cc4d84114d98 \
                            spotlight_id=spotlight-1 \
                            -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 106
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.9
x-sora-target: Sora_20180404.CastAlwaysSpotlight

{
    "channel_id": "sora",
    "connection_id": "af9103b1-2412-4a3c-88b2-cc4d84114d98",
    "spotlight_id": "spotlight-1"
}

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: 101
content-type: application/json
date: Wed, 25 Apr 2018 07:11:30 GMT
server: Cowboy

{
    "channel_id": "sora",
    "connection_id": "af9103b1-2412-4a3c-88b2-cc4d84114d98",
    "spotlight_id": "spotlight-1"
}

指定した参加者を常に画面に表示する状態を解除する

サービス

Sora

バージョン

20180404

オペレーション

CancelSpotlight

x-sora-target

Sora_20180404.CancelSpotlight

キー

channel_id

string

connection_id

string

$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20180404.CancelSpotlight \
                            channel_id=sora \
                            connection_id=af9103b1-2412-4a3c-88b2-cc4d84114d98 \
                            -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 75
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/0.9.9
x-sora-target: Sora_20180404.CancelSpotlight

{
    "channel_id": "sora",
    "connection_id": "af9103b1-2412-4a3c-88b2-cc4d84114d98"
}

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: 72
content-type: application/json
date: Wed, 25 Apr 2018 07:12:01 GMT
server: Cowboy

{
    "channel_id": "sora",
    "connection_id": "af9103b1-2412-4a3c-88b2-cc4d84114d98"
}

指定したスポットライトチャネルのビットレートを下げる

サービス

Sora

バージョン

20181023

オペレーション

DowngradeSpotlightBitRate

x-sora-target

Sora_20181023.DowngradeSpotlightBitRate

キー

channel_id

string

現時点ではどの程度下げるかどうかは指定することはできません。

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20181023.DowngradeSpotlightBitRate \
    channel_id=sora \
    -vvv

指定したスポットライトチャネルのビットレートを戻す

サービス

Sora

バージョン

20181023

オペレーション

ResetSpotlightBitRate

x-sora-target

Sora_20181023.ResetSpotlightBitRate

キー

channel_id

string

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20181023.ResetSpotlightBitRate \
    channel_id=sora \
    -vvv

サイマルキャスト API

警告

サイマルキャスト機能は実験的機能のため正式版では仕様が変更される可能性があります

指定した参加者の視聴する映像の画質を変更する

サービス

Sora

バージョン

20180820

オペレーション

ChangeSimulcastQuality

x-sora-target

Sora_20180820.ChangeSimulcastQuality

キー

channel_id

string

connection_id

string

quality

string (high | middle | low)

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20180820.ChangeSimulcastQuality \
    channel_id=sora \
    connection_id=ad31f60c-73e9-4a0b-a4ee-1de001174004 \
    quality=high \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 98
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/1.0.2
x-sora-target: Sora_20180820.ChangeSimulcastQuality

{
    "channel_id": "sora",
    "connection_id": "bfeac784-2303-4df2-b9d5-e165a55ddc09",
    "quality": "high"
}

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: 93
content-type: application/json
date: Thu, 04 Apr 2019 05:36:44 GMT
server: Cowboy

{
    "channel_id": "sora",
    "connection_id": "bfeac784-2303-4df2-b9d5-e165a55ddc09",
    "quality": "high"
}

その他の API

指定した接続のビットレートを動的に変更する

警告

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

サービス

Sora

バージョン

20190327

オペレーション

ChangeUpstreamVideoBitRate

x-sora-target

Sora_20190327.ChangeUpstreamVideoBitRate

この API は片方向とマルチストリームでのみ利用可能です。スポットライトには対応しておりません。

キー

channel_id

string

connection_id

string

bit_rate

integer (1 - 30000)

$ http POST 127.0.0.1:3000/ x-sora-target:Sora_20190327.ChangeUpstreamVideoBitRate \
    channel_id=sora \
    connection_id=35a90288-f273-404a-aef0-14d96a9d4e44 \
    bit_rate:=300 \
    -vvv
POST / HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 96
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/1.0.2
x-sora-target: Sora_20190327.ChangeUpstreamVideoBitRate

{
    "bit_rate": 300,
    "channel_id": "sora",
    "connection_id": "b1634cef-9704-4eef-9e6a-d9d0065f7147"
}

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: 91
content-type: application/json
date: Wed, 27 Mar 2019 08:38:03 GMT
server: Cowboy

{
    "bit_rate": 300,
    "channel_id": "sora",
    "connection_id": "b1634cef-9704-4eef-9e6a-d9d0065f7147"
}