ClientParams
| Field | Type | Description | Required | Default |
| logLevel | Number | Minimum level to call onLogMessage | No | 3 |
| onLogMessage | Function | A function that must be called by the application when it has internal log message | No | |
| onIssues | Function | A function that must be called by the application when it has webrtc issue | No | |
Properties
observer
Client EventEmitter, emit channel events to your application
| @returns EventEmitter | readonly |
id
Identifier of your peer
| @returns String or undefined | readonly |
peers
Array of peers in channel
availableVideoDevices
Available video devices in your browser
availableAudioDevices
Available audio devices in your browser
channelId
Current channelId
| @returns String or undefined | readonly |
appId
Current appId
| @returns String or undefined | readonly |
Methods
detectDevices()
List of available video devices in your browser
@async
@returns AvailableMediaDevices
@throws NotAllowedError
@throws NotReadableError
@throws NotFoundError
Join to specific channel
@async
@throws Error initialize engine
@throws Socket connection not initialized
leave()
Leave current channel
@async
@throws Error release engine
loadPeers()
Load peers in channel with provided role. After that, peers will be available in client.peers
| Argument | Type | Description | Required | Default |
| role | Role | Can load peers with only provided role | No | host |
@async
@throws Error release engine
deleteTrack(track)
Delete a track from storage and closes it
| Argument | Type | Description | Required | Default |
| track | track | | Yes | |
@async
Create a camera track
| Argument | Type | Description | Required | Default |
| CreateCameraVideoTrackOptions | CreateCameraVideoTrackOptions | Encoder options like width, height, RtpEncodingParameters, etc | No | |
@async
@returns Track
@throws Can not create camera track
Create a microphone track
| Argument | Type | Description | Required | Default |
| createMicrophoneAudioTrack | CreateMicrophoneAudioTrack | Encoder options like codec, opusFec, etc | No | |
@async
@returns Track
@throws Can not create camera track
Create screen media tracks - video and audio
| Argument | Type | Description | Required | Default |
| createScreenMediaOptions | CreateScreenMediaOptions | Encoder options like codec, opusFec, etc | No | |
@async
@returns Track[]
@throws Can not create camera track
Create custom track with provided mediaStream
| Argument | Type | Description | Required | Default |
| createCustomMediaOptions | CreateCustomMediaOptions | Encoder options like codec, opusFec, etc | No | |
@async
@returns Track[]
@throws Can not create camera track
Observer Events
| Name | Payload | Type |
| channel-event | event | Event |
| peer-joined | peer | Peer |
| peer-left | peerId | String |
| channel-rejoin-required | | |
| devices-list-updated | devices | AvailableMediaDevices |
| transport-connection-timeout | direction | String |
Params
| Field | Type | Description | Required | Default |
| video | MediaDeviceInfo[] | Available video devices in your browser | Yes | [] |
| audio | MediaDeviceInfo[] | Available audio devices in your browser | Yes | [] |
JoinChannelParams
| Field | Type | Description | Required | Default |
| channelId | String | Your channelId from management-api | Yes | |
| token | String | Your pregenerated JWT signaling token | Yes | |
| role | Role | Role in channel | Yes | |
| appData | Record<string, unknown> | Custom object with information about the created peer, available to all conference participants | No | |
VideoEncoderConfig
AudioEncoderConfig
ChannelEvent
| Field | Type | Description | Required | Default |
| eventName | String | | Yes | |
| data | Record<string, unknown> | | Yes | |
IssueDetectorResult
| Field | Type | Description | Required | Default |
| type | String | | Yes | |
| reason | String | | Yes | |
| ssrc | Number | | No | |
| iceCandidate | String | | No | |
| data | Number | | No | |
| debug | String | | No | |
| trackIdentifier | String | | No | |
CreateTrackOptions
CreateCameraVideoTrackOptions
CreateMicrophoneAudioTrackOptions
| Field | Type | Description | Required | Default |
| encoderConfig | AudioEncoderConfig | | No | |
| noiseSuppression | Boolean | | No | False |
Callbacks
onLogMessage
A function that must be called by the application when it has internal log message
| Payload | Type | Description | Required | Default |
| msg | String | Log message | Yes | |
| meta | Record<string, unknown> | Log meta information | Yes | |
onIssues
A function that must be called by the application when it has internal log message
| Payload | Type | Description | Required | Default |
| issue | IssueDetectorResult[] | Problems related to network, performance, CPU, etc. | Yes | |
Enums
LogLevel
| Level | Description |
| 3 | Error |
| 4 | Warn |
| 6 | Info |
| 7 | Debug |
Role
| Value | Description |
| host | Can produce and consume media in channel |
| audience | Can consume media in channel only |
VideoCodec
| Value | Description |
| h264 | |
| vp8 | |
AudioCodec