Selfie
Extends:
src/eventemitter.js~EventEmitter → Selfie
Provides access to methods for controlling a selfie. This class must not be directly instantiated. It can be obtained using session#createSelfie or listening to session#selfie-invite event.
Events
cancel
is emitted when the selfie has been finished.image
is emitted when the image is received.- string
image
- string
taking
is emitted when the remote user is taking a picture.
You can check EventEmitter2 documentation for additional information about adding and removing listeners for this events events.
Example:
How to create a Selfie
// 1. Agent side create a selfie using session object.
let selfie = session.createSelfie(['user@domain']);
// 2. Client listens to 'selfie-invite event'
session.on('selfie-invite', function(selfie){
// ... do stuff with selfie.
})
Notify the agent that user is taking a selfie
// Agent will receive 'taking' event.
selfie.on('taking', () => {...});
// Client just calls selfie method.
selfie.notifyTaking();
Send the picture to the agent
// Agent will receive 'image' event.
selfie.on('image', (imageURL) => {...});
// Client just calls selfie method.
selfie.send(imageURL);
Static Member Summary
Static Public Members | ||
public static get |
The version of the protocol implemented. |
Member Summary
Public Members | ||
public get |
isConnected: * |
Method Summary
Public Methods | ||
public |
Cancel the process at any time. |
|
public |
Send 'taking' event to the other side. |
|
public |
Send the image to the agent. |