JavaScript client library for RICOH Cloud API.
$ git clone https://github.com/ricohapi/ricoh-cloud-sdk-js.git
$ copy ricoh-cloud-sdk-js/src/sfu/sfusdk.js /path/to/your-application
Initialize SFUClient
with <Room ID>
.
const sfu = new SFUClient('up', <Room ID>);
Use setMedia
to set audio/video codecs and stream
obtained with getUserMedia()
. You can also set a handler for close events with onclose
.
sfu.setMedia({ codec_type: 'VP9', bit_rate: 1000 }, { codec_type: 'OPUS' }, stream);
sfu.onclose = () => {
// Do something.
};
Call connect()
to start broadcasting.
sfu.connect(<URL>, <Access Token>);
Initialize SFUClient
with <Room ID>
.
const sfu = new SFUClient('down', <Room ID>);
Use onaddstream
to set a remote stream object to your media and use setMedia
to set audio/video codecs. You can also set a handler for close events with onclose
.
sfu.onaddstream = event => {
// Set event.streams[0] to the srcObject attribute of your media.
};
sfu.setMedia({ codec_type: 'VP9' }, { codec_type: 'OPUS' });
sfu.onclose = () => {
// Do something.
};
Call connect()
to start watching videos.
sfu.connect(<URL>, <Access Token>);
Use disconnect()
to stop broadcasting or watching videos.
sfu.disconnect();