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
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
    },
    onReadyLocalStream: (isReady, stream) => {
          // The local video stream is or not ready
    }
};
var domElements = {
    videos: document.getElementById('videortc-videos') // App container
};
var options = {
    stream: {
        audioEnabled: true,
        videoEnabled: true,
        aDeviceId: null,
        vDeviceId: null,
         resolution: 'vga' // 'qvga', 'vga', 'hd', 'full-hd', '4k', '8k'
        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
- 
    
closeUsecase()
 - 
    
    
Close the current UseCase. It's recommended combine with disconnect method
Returns:
- Type
 - nothing
 
Example
action.closeUsecase(); myVideoApp.disconnect(); // Recommended
 - 
    
createVideoroom(isPrivate, adminKey, userKey, quality, maxPublishers, isRecord)
 - 
    
    
Creates a new VideoRoom / Conference
Parameters:
Name Type Description isPrivateBoolean Is private?
adminKeystring Administrator Room Key (Destroy)
userKeystring User Room Key (Join)
qualitystring | enum Quality: "high", "medium" or "low"
maxPublishersinteger Number of publishers/peers
isRecordBoolean Record the videoroom
Returns:
- Type
 - nothing
 
Example
action.createVideoroom(true, 'MyP455w0rd', 'Us3rPw', 'medium', 6, false);
 - 
    
destroyVideoroom(id, adminKey)
 - 
    
    
Destroys a Videoroom (Admin key is required)
Parameters:
Name Type Description idinteger VideoRoom Id
adminKeystring Administrator Room Key
Returns:
- Type
 - nothing
 
Example
action.destroyVideoroom(743267423, 'MyP455w0rd');
 - 
    
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
action.getPeers(); // Number of peers
 - 
    
joinVideoroom(name, idRoom, pin)
 - 
    
    
Join into a VideoRoom
Parameters:
Name Type Description namestring User Name
idRoominteger VideoRoom ID
pinstring Videoroom PIN to Join (Optional)
Returns:
- Type
 - nothing
 
Example
action.joinVideoroom('Mike', 743267423, 'ivr1234'); - 
    
replaceVideo(type)
 - 
    
    
Replace the local Video track
Parameters:
Name Type Description typestring ('user', 'environment', 'left', 'right' or 'next')
Example
action.replaceVideo('environment'); - 
    
toggleAudio()
 - 
    
    
Toggle Audio stream (Mute/Unmute)
Returns:
Is audio muted?
- Type
 - boolean
 
Example
action.toggleAudio(); // true or false
 - 
    
toggleVideo()
 - 
    
    
Toggle Video stream (Mute/Unmute)
Returns:
Is video muted?
- Type
 - boolean
 
Example
action.toggleVideo(); // true or false