janus-helper
Getting started
$ yarn add janus-helper
Usage
import { JanusHelper, plugins, Janus } from 'janus-helper'
janus-helper API
JanusHelper methods
setConfig(config), init
import { JanusHelper } from 'janus-helper'
const config = {
debug: true || false,
server: 'wss://localhost:28989/',
};
const janus = new JanusHelper(config);
janus.init();
injectPlugin(plugin instance, basic inforamtion {}, callbacks {}) that would return a plugin handler through Promise
Image this processs is dealing with attaching plugin to a running session.
import { JanusHelper, plugins } from 'janus-helper'
const chosenPlugin = plugins.VideoRoom;
const basicInfo = {
roomInfo: {
id: janusRoomId,
unigueRoomId,
},
userInfo: {
id: '1234',
name: 'testname',
},
filename: 'filename',
rec_dir: '/path/to/recordings-folder/',
createRoomConfig: {
request: 'create',
room: janusRoomId,
notify_joining: true,
bitrate: 128000,
publishers: 2,
record: true,
rec_dir: '/path/to/recordings-folder/',
}
};
const callbacks = {
onlocalstream: (stream) => {
},
onremotestream: (remoteList) => {
},
consentDialog: (on) => {
},
mediaState: (medium, on) => {
},
webrtcState: (on) => {
},
onmessage: (msg, jsep) => {
},
oncleanup: () => {},
}
const successCallback = handler => this.pluinHandler = handler;
const errorCallback = er => console.log(er);
janus.injectPlugin(chosenPlugin, basicInfo, callbacks).then(successCallback).catch(errorCallback);