レガシー録画 API

注意

レガシー録画機能 API は 2025 年 12 月リリースの Sora にて廃止されます。 今後は 録画機能 (セッション単位) API をご利用ください。

重要

レガシー録画機能と録画機能 (セッション単位) はチャネル単位で異なる仕組みを同時に利用できます。 例えば、channel_id a ではレガシー録画機能、channel_id b では録画機能(セッション単位)のように利用する事ができます。

録画されたファイルは sora.confarchive_dir に指定したディレクトリに置かれます。

StartRecording

x-sora-target:

Sora_20161101.StartRecording

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

クラスター機能利用時には、クラスター内のどのノードで実行しても開始された録画情報はすべてのノードで共有されます。

キー

channel_id

string

expire_time

integer

split_duration (オプション)

integer

split_only (オプション)

boolean

metadata (オプション)

object

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

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

    • 指定できる最大値はデフォルトで 86400recording_max_expire_time に指定した値で変わります

  • split_onlytruefalse を指定して下さい。指定しない場合は false が指定されます

  • split_onlytrue に指定する場合は expire_time0 を指定する必要があります

  • split_onlytrue に指定する場合は split_duration を指定する必要があります

  • split_duration を指定する範囲は 1 から 86400 までで、秒数を指定して下さい

  • metadata は JSON オブジェクトを指定してください

    • この metadatarecording.report ウェブフックやレポートファイルに含まれるようになります。

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,
    "recording_id": "C0YTCRZM715BKATBXWFPKTYGRM"
}

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,
    "recording_id": "C0YTCRZM715BKATBXWFPKTYGRM"
}

split_only が true

$ http POST 127.0.0.1:3000/ \
    x-sora-target:Sora_20161101.StartRecording \
    channel_id=sora \
    expire_time:=0 \
    split_duration:=3600 \
    split_only:=true \
    -vvv

POST / HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 84
Content-Type: application/json
Host: 127.0.0.1:3000
User-Agent: HTTPie/2.2.0
x-sora-target: Sora_20161101.StartRecording

{
    "channel_id": "sora",
    "expire_time": 0,
    "split_duration": 3600,
    "split_only": true
}

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: 121
content-type: application/json
date: Fri, 04 Dec 2020 03:04:17 GMT
server: Cowboy

{
    "channel_id": "sora",
    "expire_time": 0,
    "recording_id": "MK4J54QBGS4ES0MCSZMF6C9M9M",
    "split_duration": 3600,
    "split_only": true
}

エラー

  • "STARTED-RECORDING"

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

    $ 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"
    }
    
  • "NOT-CLUSTER-MAJORITY"

    • クラスターで過半数以下のグループに所属している

StopRecording

x-sora-target:

Sora_20161101.StopRecording

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

この API は非同期です。200 が返ってきた場合でも録画ファイルや録画メタデータファイルが生成されていることを保証しません。 イベントウェブフックの archive.available または recording.report の通知を利用してください。

キー

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

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

  • "NOT-CLUSTER-MAJORITY"

    • クラスターで過半数以下のグループに所属している

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,
    "created_at": 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-CLUSTER-MAJORITY"

    • クラスターで過半数以下のグループに所属している

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/2.4.0
x-sora-target: Sora_20161101.ListStartedRecording



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: 307
content-type: application/json
date: Tue, 30 Nov 2021 01:13:10 GMT
server: Cowboy

[
    {
        "channel_id": "sora",
        "created_at": 1638234656,
        "expire_time": 3600,
        "expired_at": 1638238256,
        "recording_id": "WWZ61PT4GS03F80F39MCPVSEQR",
        "split_only": false
    },
    {
        "channel_id": "zakuro",
        "created_at": 1638234654,
        "expire_time": 3600,
        "expired_at": 1638238254,
        "recording_id": "Z60BJP5YDN4PD0D7RGM4TFEE48",
        "split_only": false
    }
]

エラー

  • "NOT-CLUSTER-MAJORITY"

    • クラスターで過半数以下のグループに所属している

ListArchiving

x-sora-target:

Sora_20161101.ListArchiving

現在録画中の状態を取得します。

注釈

クラスター機能利用時であっても、API を実行したノードで録画中の状態のみを取得します。 クラスター内で録画中のすべてを取得したい場合はすべてのノードに ListArchiving API を実行する必要があります。

$ 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": "C0YTCRZM715BKATBXWFPKTYGRM",
        "bundle_id": "C0YTCRZM715BKATBXWFPKTYGRM",
        "connection_id": "C0YTCRZM715BKATBXWFPKTYGRM",
        "seconds": 146,
        "video": {
            "bit_rate": 1000,
            "codec_type": "VP9",
            "vp9_params": { "profile_id": 0 }
        }
    }
]
  • seconds は録画を開始してからの経過時間(秒)です

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

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

© Copyright 2024, Shiguredo Inc Created using Sphinx 7.3.7