Sora JavaScript SDK は株式会社時雨堂が開発、販売している WebRTC SFU Sora をブラウザから扱うための SDK です。
使い方は Sora JavaScript SDK ドキュメント を参照してください。
- sora.js
- sora.min.js
Support for Sora JavaScript SDK by Shiguredo Inc. are limited ONLY in JAPANESE through GitHub issues and there is no guarantee such as response time or resolution.
Sora JavaScript SDK に関する質問・要望・バグなどの報告は Issues の利用をお願いします。 ただし、 Sora のライセンス契約の有無に関わらず、 Issue への応答時間と問題の解決を保証しませんのでご了承ください。
Sora JavaScript SDK に対する有償のサポートについては現在提供しておりません。
- WebRTC SFU Sora 18.04 以降
- Upstream/Downstream
- Multistream
- Multistream Downstream
質問やバグ報告の場合は、次の開発環境のバージョンを 「メジャーバージョン、マイナーバージョン、メンテナンスバージョン」 まで含めて書いてください。
- Sora JavaScript SDK のバージョン
- 利用ブラウザのバージョン
-
connection(signalingUrl, debug=false)
Param Type Default Description signalingUrl string シグナリング先 URL debug boolean false デバッグフラグ
example
var sora = Sora.connection('ws://127.0.0.1/signaling');
配信者として接続する
-
sora.publisher(channelId, metadata, options={});
Param Type Default Description channelId string チャネルID metadata string メタデータ options object シグナリングパラメーター * audio boolean true オーディオ有効/無効 * audioCodecType string オーディオコーデックタイプ(OPUS/PCMU) * audioBitRate integer オーディオビットレートの最大値 * video boolean true ビデオ有効/無効 * videoCodecType string ビデオコーデックタイプ(VP8/VP9/H264) * videoBitRate integer ビデオビットレートの最大値 * multistream boolean マルチストリーム有効/無効 * spotlight integer 最大話者数 * simulcast boolean サイマルキャスト有効/無効 -
connect(stream)
Param Type Default Description mediaStream MediaStream Object メディアストリームオブジェクト -
disconnect()
Param Type Default Description -
on(kind, callback)
Param Type Default Description kind string イベントタイプ(disconnect, push, addstream, removestream, notify, log) callback function コールバック
example
var channelId = 'Sora';
var metadata = 'ham';
var publisher = sora.publisher(channelId, metadata);
navigator.mediaDevices.getUserMedia({audio: true, video: true})
.then(mediaStream => {
// connect
publisher.connect(mediaStream)
.then(stream => {
// stream を video.src に追加する等の処理
});
})
.catch(e => {
console.error(e);
});
// disconnect
publisher.disconnect()
.then(() => {
// video を止める等の処理
});
// event
publisher.on('disconnect', function(e) {
console.error(e);
});
視聴者として接続する
-
sora.subscriber(channelId, metadata, options={});
Param Type Default Description channelId string チャネルID metadata string メタデータ options object シグナリングパラメーター * audio boolean true オーディオ有効/無効 * audioCodecType string オーディオコーデックタイプ(OPUS/PCMU) * audioBitRate integer オーディオビットレートの最大値 * video boolean true ビデオ有効/無効 * videoCodecType string ビデオコーデックタイプ(VP8/VP9/H264) * videoBitRate integer ビデオビットレートの最大値 * multistream boolean マルチストリーム有効/無効 * spotlight integer 最大話者数 * simulcast boolean サイマルキャスト有効/無効 * simulcastQuality string サイマルキャストクオリティ(low/middle/high) -
connect()
Param Type Default Description -
disconnect()
Param Type Default Description -
on(kind, callback)
Param Type Default Description kind string イベントタイプ(disconnect, push, addstream, removestream, notify, log) callback function コールバック
example
var channelId = 'Sora';
var metadata = 'ham';
var subscriber = sora.subscriber(channelId, metadata, options);
// connect
subscriber.connect()
.then(stream => {
// stream を video.src に追加する等の処理
})
.catch(e => {
console.error(e);
});
// disconnect
subscriber.disconnect()
.then(() => {
// video を止める等の処理
});
// event
publisher.on('disconnect', function(e) {
console.error(e);
});
$ git clone https://github.com/shiguredo/sora-js-sdk.git
$ cd sora-js-sdk
$ yarn install
$ npm run build
$ npm run build -- --watch
$ npm run dev
$ npm run check
$ npm run test
$ npm run build