new videoCall(onEvents, domElements, options)
VideoCall usecase
Parameters:
| Name | Type | Description | 
|---|---|---|
onEvents | 
            
            object | Event handlers: onEvents  | 
        
domElements | 
            
            object | DOM elements: domElements  | 
        
options | 
            
            object | Available options: options  | 
        
Returns:
VideoCall actions
- Type
 - Promise
 
Example
var onEvents = {
    onAccepted: userName => {
         // Call accepted
    },
    onCalling: () => {
         // Calling a peer
    },
    onDataReceived: (type, data, filename) => {
        // Data received by the datachannel
        if(type === 'application/x-chat') { }
        else if(type === 'text/plain') { }
        else if(type === 'application/pdf') { }
        else if(type === 'application/zip') { }
        else if(type === 'application/x-rar') { }
        else if(type === 'image/jpeg') {}
        else if(type === 'image/png') {}
        else if(type === 'application/x-docx') {}
        else if(type === 'application/x-pptx') {}
        else if(type === 'application/x-xlsx') {}
        else if(type === 'application/vnd.oasis.opendocument.text') {}
    },
    onGotPeers: list => {
         // List of registered peers
    },
    onHangUp: (userName, reason) => {
         // Hang up call
    },
    onIncomingCall: userName => {
         // Incoming call from a peer
    },
    onRegistered: (userName, isRegistered) => {
         // Successful or unsuccessful registration
    },
    onSetCall: () => {
         // Configured call
    },
    onFileTransferOk: fileId => {
         // File Transfer OK
    },
    onFileTransferKo: fileId => {
         // File Transfer KO
    },
    onRemoteStreamReady: (isReady, stream) => {
        // The remote stream  is ready
    }
};
var domElements = {
    videos: document.getElementById('videos')
};
var options = { // Optional
     stream: {
         aDeviceId: null,
         vDeviceId: null,
         resolution: 'vga' // 'qvga', 'vga', 'hd', 'full-hd', '4k', '8k'
     },
     dataChannel: {
         dataEnabled: true,
         allowedTypes: ['application/x-chat', 'image/jpeg', 'image/png', 'application/pdf'],
         maxSize: 5, // In MB
         fileTransmission: {
             timeout: 5, // Minutes
             retransmissionDelay: 15 // Seconds
         }
     },
     display: {
         namePattern: /^__default__/i
     },
     account: "******" // Multiple mode
};
usecases.videoCall(onEvents, domElements, options)
    .then(action => {
         // Use Case has been atacched succesfully
         ...
    })
    .catch(cause => {
        // Error attaching the Use Case
        console.log("Error Attach " + cause );
    })
    
Methods
- 
    
acceptCall()
 - 
    
    
Accept an incoming call
Returns:
- Type
 - nothing
 
Example
action.acceptCall();
 - 
    
call(userName)
 - 
    
    
Call to peer registered
Parameters:
Name Type Description userNamestring Name of a peer registered
Returns:
- Type
 - nothing
 
Example
action.call('Simon'); - 
    
closeUsecase()
 - 
    
    
Close the current UseCase. It's recommended combine with disconnect method
Returns:
- Type
 - nothing
 
Example
action.closeUsecase(); myVideoApp.disconnect(); // Recommended
 - 
    
getPeers(filter, order)
 - 
    
    
Get list of peers registered/incall (Array)
Parameters:
Name Type Description filterRegExp RegExp to filter the list of peers. e.g: /^default/i
orderstring ["ASC"|"DESC"] Order array of peers
Returns:
- 
- Type
 - nothing
 
 - 
- Type
 - nothing
 
 
Example
action.getPeers(/^__default__/i, "ASC");
 - 
 - 
    
hangUp()
 - 
    
    
Hang up/Decline a call
Returns:
- Type
 - nothing
 
Example
action.hangUp();
 - 
    
register(userName)
 - 
    
    
Register a peer in the VideoCall Usecase
Parameters:
Name Type Description userNamestring (Alphanumeric)
Returns:
- Type
 - nothing
 
Example
action.register('Mike'); - 
    
replaceVideo(type)
 - 
    
    
Replace the local Video track
Parameters:
Name Type Description typestring ('user', 'environment', 'left', 'right' or 'next')
Example
action.replaceVideo('environment'); - 
    
sendData(type, data, cOk, cKo, (Optional))
 - 
    
    
Sends a message (Chat or File) through the DataChannel
Parameters:
Name Type Description typestring MIME Type (e.g: 'application/x-chat', 'text/plain', 'application/pdf', 'application/zip', 'application/x-rar', 'image/jpeg', 'image/png', 'application/x-docx', 'application/x-pptx', 'application/x-xlsx', 'application/vnd.oasis.opendocument.text')
datastring Data Content
cOkfunction Callback success function
cKofunction Callback failed function
(Optional)string filename File Name (e.g: file.zip)
Returns:
- Type
 - nothing
 
Example
action.sendData('application/x-chat', 'Hello Mike!', function(cOk) { // Success }, function(error) { // Error console.log(error); } ) - 
    
setCall(audio, video, quality)
 - 
    
    
Configure the call settings on the fly
Parameters:
Name Type Description audioboolean Audio Enabled
videoboolean Video Enabled
qualitystring Call Quality: "high", "medium", "low"
Returns:
- Type
 - nothing
 
Example
action.setCall(true, true, "medium");
 - 
    
toggleAudio()
 - 
    
    
Toggle local Audio stream (Mute/Unmute)
Returns:
Is audio muted?
- Type
 - boolean
 
Example
action.toggleAudio(); // true or false
 - 
    
toggleVideo()
 - 
    
    
Toggle local Video stream (Mute/Unmute)
Returns:
Is video muted?
- Type
 - boolean
 
Example
action.toggleVideo(); // true or false