new videoRoom(onEvents, domElements, options)
VideoRoom usecase
Parameters:
Name | Type | Description |
---|---|---|
onEvents |
object | Event handlers: onEvents |
domElements |
object | DOM elements: domElements |
options |
object | Available options: options |
Returns:
VideoRoom actions
- Type
- Promise
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
var onEvents = {
onCreated: id => {
// Videoroom ID created
},
onError: (cause, code) => {
// An error has occurred
},
onJoined: () => {
// You've joined the Videoroom
},
onDestroyed: () => {
// Videoroom ID destroyed
},
onPeerJoined: (id, display) => {
// A new peer has joined the videoroom
},
onPeerLeft: (id, display) => {
// A new peer has left the videoroom
}
};
var domElements = {
videos: document.getElementById('videortc-videos') // App container
};
var options = {
stream: {
audioEnabled: true,
videoEnabled: true,
aDeviceId: null,
vDeviceId: null,
voiceProcessor: false
},
account: "******" // Multiple mode
};
usecases.videoRoom(onEvents, domElements, options)
.then(action => {
// Use Case has been atacched succesfully
...
})
.catch(cause => {
// Error attaching the Use Case
Janus.error("Error Attach " + cause );
})
Methods
-
<inner> closeUsecase()
-
Close the current UseCase. It's recommended combine with disconnect method
Returns:
- Type
- nothing
Example
-
<inner> createVideoroom(isPrivate, adminKey, userKey, quality, maxPublishers, isRecord)
-
Creates a new VideoRoom / Conference
Parameters:
Name Type Description isPrivate
Boolean Is private?
adminKey
string Administrator Room Key (Destroy)
userKey
string User Room Key (Join)
quality
string | enum Quality: "high", "medium" or "low"
maxPublishers
integer Number of publishers/peers
isRecord
Boolean Record the videoroom
Returns:
- Type
- nothing
Example
1
action.createVideoroom(true, 'MyP455w0rd', 'Us3rPw', 'medium', 6, false);
-
<inner> destroyVideoroom(id, adminKey)
-
Destroys a Videoroom (Admin key is required)
Parameters:
Name Type Description id
integer VideoRoom Id
adminKey
string Administrator Room Key
Returns:
- Type
- nothing
Example
1
action.destroyVideoroom(743267423, 'MyP455w0rd');
-
<inner> getPeers()
-
Gets the number of peers/users connected into the current Videoroom
Returns:
Number of peers/users connected into the current Videoroom
- Type
- integer
Example
1
action.getPeers(); // Number of peers
-
<inner> joinVideoroom(name, idRoom, pin)
-
Join into a VideoRoom
Parameters:
Name Type Description name
string User Name
idRoom
integer VideoRoom ID
pin
string Videoroom PIN to Join (Optional)
Returns:
- Type
- nothing
Example
1
action.joinVideoroom('Mike', 743267423, 'ivr1234');
-
<inner> toggleAudio()
-
Toggle Audio stream (Mute/Unmute)
Returns:
Is audio muted?
- Type
- boolean
Example
1
action.toggleAudio(); // true or false
-
<inner> toggleVideo()
-
Toggle Video stream (Mute/Unmute)
Returns:
Is video muted?
- Type
- boolean
Example
1
action.toggleVideo(); // true or false