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
     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
- 
    <inner> acceptCall()
- 
    
    Accept an incoming call Returns:- Type
- nothing
 Exampleaction.acceptCall(); 
- 
    <inner> call(userName)
- 
    
    Call to peer registered Parameters:Name Type Description userNamestring Name of a peer registered Returns:- Type
- nothing
 Exampleaction.call('Simon');
- 
    <inner> closeUsecase()
- 
    
    Close the current UseCase. It's recommended combine with disconnect method Returns:- Type
- nothing
 Exampleaction.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 Returns:- 
- Type
- nothing
 
- 
- Type
- nothing
 
 Exampleaction.getPeers(/^__default__/i, "ASC"); 
- 
- 
    <inner> hangUp()
- 
    
    Hang up/Decline a call Returns:- Type
- nothing
 Exampleaction.hangUp(); 
- 
    <inner> register(userName)
- 
    
    Register a peer in the VideoCall Usecase Parameters:Name Type Description userNamestring (Alphanumeric) Returns:- Type
- nothing
 Exampleaction.register('Mike');
- 
    <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) Returns:- Type
- nothing
 Exampleaction.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" Returns:- Type
- nothing
 Exampleaction.setCall(true, true, "medium"); 
- 
    <inner> toggleAudio()
- 
    
    Toggle local Audio stream (Mute/Unmute) Returns:Is audio muted? - Type
- boolean
 Exampleaction.toggleAudio(); // true or false 
- 
    <inner> toggleVideo()
- 
    
    Toggle local Video stream (Mute/Unmute) Returns:Is video muted? - Type
- boolean
 Exampleaction.toggleVideo(); // true or false