new videoCall(onEvents, domElements, options)
VideoCall usecase
Parameters:
| Name | Type | Description | 
|---|---|---|
onEvents | 
            
            object | Event handlers: onAccepted, onCalling, onDataReceived, onGotPeers, onHangUp, onIncomingCall, onRegistered, onSetCall, onFileTransferOk, onFileTransferKo  | 
        
domElements | 
            
            object | DOM elements: videos  | 
        
options | 
            
            object | Available options: dataChannel, display  | 
        
- Source:
 
Returns:
VideoCall methods: call, acceptCall, closeUsecase, getPeers, hangUp, register, sendData, setCall, toggleAudio, toggleVideo
- Type
 - Promise
 
Example
var onEvents = {
    onAccepted: function(userName) {
         // Accepted
    },
    onCalling: function() {
         // Calling
    },
    onDataReceived: function(type, data, filename) {
        // Data received
        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: function(list) {
         // Peers registered ready
    },
    onHangUp: function(userName, reason) {
         // HangUp / Decline
    },
    onIncomingCall: function(userName) {
         // Incoming call
    },
    onRegistered: function(userName, isRegistered) {
         // Registered
    },
    onSetCall: function() {
         // Set
    },
    onFileTransferOk: function(fileId) {
         // File Transfer OK
    },
    onFileTransferKo: function(fileId) {
         // File Transfer KO
    }
};
var domElements = {
    videos: document.getElementById('videos')
};
var options = { // Optional
     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
     }
};
usecases.videoCall(onEvents, domElements, options)
    .then(function(action) {
         // Use Case has been atacched succesfully
         ...
    })
    .catch(function(cause) {
        // Error attaching the Use Case
        console.log("Error Attach " + cause );
    })
    
Methods
- 
    
<inner> acceptCall()
 - 
    
    
Accept an incoming call
- Source:
 
Returns:
- Type
 - nothing
 
 - 
    
<inner> call(userName)
 - 
    
    
Call to peer registered
Parameters:
Name Type Description userNamestring Name of a peer registered
- Source:
 
Returns:
- Type
 - nothing
 
 - 
    
<inner> closeUsecase()
 - 
    
    
Close the current UseCase. It's recommended combine with disconnect method
- Source:
 
Returns:
- Type
 - nothing
 
Example
action.closeUsecase(); myVideoApp.disconnect(); // Recommended
 - 
    
<inner> 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
- Source:
 
Returns:
- Type
 - nothing
 
 - 
    
<inner> hangUp()
 - 
    
    
Hang up/Decline a call
- Source:
 
Returns:
- Type
 - nothing
 
 - 
    
<inner> register(userName)
 - 
    
    
Register a peer in the VideoCall Usecase
Parameters:
Name Type Description userNamestring (Alphanumeric)
- Source:
 
Returns:
- Type
 - nothing
 
 - 
    
<inner> 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)
- Source:
 
Returns:
- Type
 - nothing
 
Example
action.sendData('application/x-chat', 'Hello Mike!', function(cOk) { // Success }, function(error) { // Error console.log(error); } ) - 
    
<inner> 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"
- Source:
 
Returns:
- Type
 - nothing
 
 - 
    
<inner> toggleAudio()
 - 
    
    
Toggle local Audio stream (Mute/Unmute)
- Source:
 
Returns:
Is audio muted?
- Type
 - boolean
 
Example
action.toggleAudio(); // true or false
 - 
    
<inner> toggleVideo()
 - 
    
    
Toggle local Video stream (Mute/Unmute)
- Source:
 
Returns:
Is video muted?
- Type
 - boolean
 
Example
action.toggleVideo(); // true or false