Class: splitAgent

splitAgent

Split Agent Use Case


new splitAgent(onEvents, domElements, streamOptions)

Split Agent Use Case

Parameters:
Name Type Description
onEvents object

Event handlers: onDestroyed, onError, onJoined, onDataReceived, onAcceptedVideo

domElements object

DOM elements: client, agent, screenAgent

streamOptions object

Stream options: agentName, sessionId, aDeviceId, vDeviceId

Source:
Returns:

Split Agent methods: getLicense, sendData, startRecording, startScreensharing, stopRecording, stopScreensharing, toggleVideo

Type
Promise
Example
var onEvents = {
    onDestroyed: function() {
         // Destroyed
    },
    onError: function(cause) {
         // Error
    },
    onJoined: function(screenRoom) {
         // Joined
    },
    onDataReceived: function(type, data, filename) {
        // Data received
        if(type === 'application/x-chat') { }
        if(type === 'text/plain') { }
        if(type === 'application/pdf') { }
        if(type === 'application/zip') { }
        if(type === 'application/x-rar') { }
        if(type === 'image/jpeg') {}
        if(type === 'image/png') {}
        if(type === 'application/x-docx') {}
        if(type === 'application/x-pptx') {}
        if(type === 'application/x-xlsx') {}
    },
    onAcceptedVideo: function() {
         // Accepted Video
    }
};

var domElements = {
    client: document.getElementById('clientvideo'),
    agent: document.getElementById('agentvideo'),
    screenAgent: document.getElementById('screen')
};

var streamOptions = {
    agentName: 'Anna',
    sessionId: 6655,
    aDeviceId: null,
    vDeviceId: null
};

usecases.splitAgent(onEvents, domElements, streamOptions)
    .then(function(action) {
         // Use Case has been atacched succesfully
         ...
    })
    .catch(function(cause) {
        // Error attaching the Use Case
        console.log("Error Attach " + cause );
    })

Methods


<inner> getLicense()

Get License

Source:
Returns:

License Information (Screensharing, Livechat and VideoRecording )

Type
Object
Example
var myLicense = action.getLicense();
console.log(myLicense);

<inner> sendData(type, data, cOk, cKo, (Optional))

Send a Data message through the DataChannel

Parameters:
Name Type Description
type string

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')

data string

Data Content

cOk function

Callback success function

cKo function

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> startRecording()

Start Recording (Master)

Source:
Returns:
Type
nothing
Example
action.startRecording();

<inner> startScreensharing(screenId, cOk, cKo)

Start ScreenSharing Mode

Parameters:
Name Type Description
screenId integer

Screen Id

cOk function

Callback Ok

cKo function

Callback Error

Source:
Returns:
Type
nothing
Example
action.startScreensharing(1234, function() {
     // Success
}, function(cause) {
     // Error
})

<inner> stopRecording()

Stop Recording (Master)

Source:
Returns:
Type
nothing
Example
action.stopRecording();

<inner> stopScreensharing(cOk, cKo)

Stop ScreenSharing

Parameters:
Name Type Description
cOk function

Callback Ok

cKo function

Callback Error

Source:
Returns:
Type
nothing
Example
action.stopScreensharing(function() {
     // Success
}, function(cause) {
     // Error
})

<inner> toggleVideo()

Toggle local Video stream

Source:
Returns:

Is video muted?

Type
boolean
Example
action.toggleVideo(); // true or false