new WRTCClient(config)
Create a WebRTC client
Parameters:
| Name |
Type |
Description |
config |
object
|
The configuration object
Properties
| Name |
Type |
Description |
serverUrl |
string
|
The server URL |
iceServers |
Array
|
The ICE Server descriptor array |
maxAvgBitrate |
number
|
The maximum average stream bitrate |
|
Members
Called when changed audio level from a audio stream
Type:
Called when received room occupancies
Type:
Called when received a chat message
Type:
Called when connected to server
Type:
Called when disconnected from server
Type:
Called when a remote peer in current room changed the mic enabled state
Type:
Called when a remote peer in current room changed the mic mute state
Type:
Called when a remote peer changed the spot in current room
Type:
Called when the mixed audio stream is available
Type:
onmixedaudiostreamremoved
Called when the mixed audio stream is removed
Called when a remote stream is available
Type:
Called when a remote stream is removed
Type:
Called when received peer's infos
Type:
Methods
connect(name) → {void}
Connect to the server
Parameters:
| Name |
Type |
Description |
name |
string
|
The peer name (temporary parameter) |
Returns:
-
Type
-
void
createFloor(name, universeIndex, xSize, ySize, additionalProperties, onSuccess, onFailed) → {void}
Creates a new floor
Parameters:
| Name |
Type |
Description |
name |
string
|
The name of the new floor |
universeIndex |
number
|
The index of the universe |
xSize |
number
|
The size of the floor on x axis |
ySize |
number
|
The size of the floor on y axis |
additionalProperties |
object
|
Additional properties (future use) |
onSuccess |
WRTCClient~onSuccess
|
|
onFailed |
WRTCClient~onFailed
|
|
Returns:
-
Type
-
void
disconnect() → {void}
Disconnect from server
Returns:
-
Type
-
void
Gets the MediaDevicesMonitor
Returns:
-
Type
-
object
joinFloor(floorName, universeIndex, onJoinFloorSuccess, onFailed) → {void}
Join to a floor
Parameters:
Returns:
-
Type
-
void
joinRoom(name, spotInd, onSuccess, onFailed) → {void}
Join to a room
Parameters:
Returns:
-
Type
-
void
leaveFloor() → {void}
Leave the floor
Returns:
-
Type
-
void
leaveRoom() → {void}
Leave the room
Returns:
-
Type
-
void
loginPeer(peerName, jwtopt, onSuccess, onFailed) → {void}
Login peer in server
Parameters:
Returns:
-
Type
-
void
removeFloor(name, universeIndex, onSuccess, onFailed) → {void}
Removes a floor
Parameters:
Returns:
-
Type
-
void
requestAllFloorsInfos(universeIndex, onSuccess, onFailed) → {void}
Requests floors' infos of all floor in a universe
Parameters:
Returns:
-
Type
-
void
requestFloorOccupancy(floorName, universeIndex, onSuccess, onFailed) → {void}
Requests the occupancy of a floor
Parameters:
Returns:
-
Type
-
void
requestFloorsOccupancies(universeIndex, onSuccess, onFailed) → {void}
Requests the occuppancies of all floors
Parameters:
Returns:
-
Type
-
void
requestInsideRoomPeersInfos() → {void}
Requests peer's infos of the current room (See onrequestinsideroompeersinfosresponse)
Returns:
-
Type
-
void
Requests a peer's state
Parameters:
Returns:
-
Type
-
void
requestRoomState(name, floorNname, universeIndex, onSuccess, onFailed) → {void}
Requests a room current state
Parameters:
Returns:
-
Type
-
void
requestRoomsOccupancies(floorName, universeIndex, onSuccess, onFailed) → {void}
Requests rooms' occupancies in a floor
Parameters:
Returns:
-
Type
-
void
sendChatMessage(messageObject, dstPeerId) → {void}
Sends a chat message
Parameters:
| Name |
Type |
Description |
messageObject |
object
|
The message object |
dstPeerId |
number
|
The remote peer's id (or INVALID_PEER_ID to broadcast) |
Returns:
-
Type
-
void
Sets the audio input device
Parameters:
| Name |
Type |
Description |
deviceId |
string
|
The device id |
Returns:
-
Type
-
Promise
Sets the gain of the local mic
Parameters:
| Name |
Type |
Description |
gain |
number
|
The gain (between 0 and 1) |
Returns:
-
Type
-
void
Sets the mute state of the local mic
Parameters:
| Name |
Type |
Description |
mute |
boolean
|
The mute state |
Returns:
-
Type
-
void
setLogLevel(level) → {void}
Sets the log level
Parameters:
| Name |
Type |
Description |
level |
string
|
The name of the level: 'info', 'warn', 'debug', 'error' |
Returns:
-
Type
-
void
setReverbImpulseResponse(url) → {Promise}
Sets the impulse response audio file used to create reverb effect
Parameters:
| Name |
Type |
Description |
url |
string
|
The url of the audio file |
Returns:
-
Type
-
Promise
setVirtualRoomFrameSize(cols, rows) → {void}
Sets the size of the room in terms of spot
Parameters:
| Name |
Type |
Description |
cols |
number
|
The number of cols |
rows |
number
|
The number of rows |
Returns:
-
Type
-
void
tryChangeInsideRoomSpot(col, row) → {void}
Tries to change the spot in current room
Parameters:
| Name |
Type |
Description |
col |
number
|
The col of the spot |
row |
number
|
The row of the spot |
Returns:
-
Type
-
void
trySetAudioOutputDevice(deviceId) → {Promise}
Tries to set the audio output device
Parameters:
| Name |
Type |
Description |
deviceId |
string
|
The device id |
Returns:
-
Type
-
Promise
Type Definitions
Error
Type:
Properties:
| Name |
Type |
Description |
msg |
string
|
The error message |
code |
number
|
The error code |
PeersInfo
Type:
Properties:
| Name |
Type |
Description |
peerId |
number
|
Peer's id |
peerName |
string
|
Peer's name |
spotCoordJ |
number
|
Column of the spot |
spotCoordX |
number
|
Row of the spot |
muted |
bool
|
Peer's mic mute state |
micEnabled |
bool
|
Peer's mic has been enabled |
RoomOccupancy
Type:
Properties:
| Name |
Type |
Description |
name |
string
|
Room name |
occup |
number
|
Amount of peers in the room |
onAudioStreamLevelChanged(newLevel, peerId) → {void}
Parameters:
| Name |
Type |
Description |
newLevel |
number
|
The new audio level |
peerId |
number
|
The peer's id |
Returns:
-
Type
-
void
onCastRoomsOccupancies(occupancies) → {void}
Parameters:
Returns:
-
Type
-
void
onChatMessage(messageObject, peerId) → {void}
Parameters:
| Name |
Type |
Description |
messageObject |
object
|
The message object |
peerId |
number
|
The peer's id |
Returns:
-
Type
-
void
onEvent() → {void}
Returns:
-
Type
-
void
onFailed(err) → {void}
Parameters:
Returns:
-
Type
-
void
onInsideRoomPeerMicEnabledStateChanged(newState, peerId) → {void}
Parameters:
| Name |
Type |
Description |
newState |
number
|
The new mic enabled state |
peerId |
number
|
The remote peer's id |
Returns:
-
Type
-
void
onInsideRoomPeerMuteStateChanged(newState, peerId) → {void}
Parameters:
| Name |
Type |
Description |
newState |
number
|
The new mute state |
peerId |
number
|
The remote peer's id |
Returns:
-
Type
-
void
Parameters:
| Name |
Type |
Description |
col |
number
|
The spot col |
row |
number
|
The spot row |
peerId |
number
|
The peer's id |
peerName |
string
|
The peer's name |
Returns:
-
Type
-
void
onJoinFloorSuccess(obj) → {void}
Parameters:
| Name |
Type |
Description |
obj |
object
|
Properties
| Name |
Type |
Description |
size |
number
|
The floor size
Properties
| Name |
Type |
Description |
x |
number
|
The number of rooms in x-axis |
y |
number
|
The number of rooms in y-axis |
|
position |
number
|
The position in the universe
Properties
| Name |
Type |
Description |
x |
number
|
The coord x of the floor |
y |
number
|
The coord y of the floor |
z |
number
|
The coord z of the floor |
|
name |
string
|
The floor name |
universeIndex |
number
|
The universe index |
|
Returns:
-
Type
-
void
onMixedAudioStreamAvailable(stream) → {void}
Parameters:
| Name |
Type |
Description |
stream |
object
|
The audio stream |
Returns:
-
Type
-
void
onRemoteStreamAvailable(stream, edgeId) → {void}
Parameters:
| Name |
Type |
Description |
stream |
object
|
The audio stream |
edgeId |
number
|
The edge id |
Returns:
-
Type
-
void
onRemoteStreamRemoved(edgeId) → {void}
Parameters:
| Name |
Type |
Description |
edgeId |
number
|
The edge id |
Returns:
-
Type
-
void
onRequestAllFloorsInfosSuccess(obj) → {void}
Parameters:
| Name |
Type |
Description |
obj |
object
|
Properties
| Name |
Type |
Description |
floors |
Array
|
The floor info array |
universeIndex |
number
|
The universe index |
|
Returns:
-
Type
-
void
onRequestFloorOccupancySuccess(obj) → {void}
Parameters:
| Name |
Type |
Description |
obj |
object
|
Properties
| Name |
Type |
Description |
occupancy |
number
|
The floor occupancy |
name |
string
|
The floor name |
universeIndex |
number
|
The universe index |
|
Returns:
-
Type
-
void
onRequestFloorsOccupanciesSuccess(obj) → {void}
Parameters:
| Name |
Type |
Description |
obj |
object
|
Properties
| Name |
Type |
Description |
floors |
Array
|
The floors occupancies |
universeIndex |
number
|
The universe index |
|
Returns:
-
Type
-
void
onRequestInsideRoomPeersInfosResponse(peersInfo) → {void}
Parameters:
Returns:
-
Type
-
void
Parameters:
| Name |
Type |
Description |
obj |
object
|
Properties
| Name |
Type |
Description |
state |
object
|
The peer's state |
|
Returns:
-
Type
-
void
onRequestRoomStateSuccess(obj) → {void}
Parameters:
| Name |
Type |
Description |
obj |
object
|
Properties
| Name |
Type |
Description |
state |
object
|
The room state |
floorName |
string
|
The floor name |
universeIndex |
number
|
The universe index |
|
Returns:
-
Type
-
void
onRequestRoomsOccupanciesSuccess(obj) → {void}
Parameters:
| Name |
Type |
Description |
obj |
object
|
Properties
| Name |
Type |
Description |
rooms |
Array
|
The room occupancies |
floorName |
string
|
The floor name |
universeIndex |
number
|
The universe index |
|
Returns:
-
Type
-
void
onSuccess() → {void}
Returns:
-
Type
-
void