Constructor
new ELive(config)
Constructor of ELive
Parameters:
Name | Type | Description |
---|---|---|
config |
config | please refer the config page |
Example
const elive = new ELive({...})
elive.call('demo')
elive.on('onCall|onCast|onWatch|onComplete', (msg) => {})
...
elive.close()
Methods
(async) call(name)
Create or join a 1:1 room.
You can receive a 'onCall' and 'onComplete' callback events.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of 1:1 room |
(async) captureScreen()
Capture the screen and use it as the source of local media.
(async) cast(name)
Create a broadcast room.
You can receive a 'onCast' callback event.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of broadcast room |
(async) close()
Close all connection
getDevices()
Get list of all local media devices such as video, speaker and mic.
getHealth()
Get the quality of the stream realtime. WebRTC is variable in quality depending on network conditions.
getRoomId()
Get a room id
muteLocal(isMute)
Mute local media
Parameters:
Name | Type | Description |
---|---|---|
isMute |
boolean |
muteRemote(isMute)
Mute remote media
Parameters:
Name | Type | Description |
---|---|---|
isMute |
boolean |
onEvent(message)
Method for callback event to sdk users.
ELive callback events include the following.
Parameters:
Name | Type | Description |
---|---|---|
message |
EventEmitter.message |
(async) search(id)
Search the room of the current service. If there is no parameter, it searches all rooms of the service.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | search keyword for room |
sendMessage(msg)
Send a message to a peer. It can be used for text messaging and data transfer.
It is only available in P2P mode yet.
Parameters:
Name | Type | Description |
---|---|---|
msg |
string |
setAgc()
Set the AutoGainControl value. Default value is a true.
(async) setAudioInput()
Use a specific audio input device as local media. You can gather a device list from getDevices()
setChannelCount()
Set the number of audio channel. Default value is 2.
setEchoCancellation()
Set the echo canellation value. Default value is a true.
setFrameRate()
Set the framerate value. It is selectable from 10 to 30.
setLatency()
Set the echo latency of audio.
setNoiseSuppression()
Set the noise suppression value. Default value is a true.
setResolution()
Set the resolution value. It is selectable from 240p to 1280p. Default value is a (640,480)
(async) setVideoInput()
Use a specific video input device as local media. You can gather a device list from getDevices()
setVolume()
volume value should be number from 0.0 to 1.0.
(async) showLocalVideo()
Use this when you want to display the local input device in the local video tag before calling call or cast method.
stopCaptureScreen()
Stop the captureScreen
(async) switchCamera()
If there is more than one camera, switch it.
(async) watch(name)
Participate to a broadcast room as a viewer.
You can receive a 'onWatch' callback event.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of broadcast room |