MediaEngine

A Media Engine is a plugin that can handle transitions of one or more media types using a specific implementation of the media. The buildin media types of Vivocha are chat, audio and video: possible examples of MediaEngines include a Facebook chat handler, a Skype audio/video handler, a SMS chat engine. The MediaEngine is a pure virtual class (similar to a Java interface): it must be derived (extended) to used and all its methods must be overridden.

Table of Contents

Constructor

new MediaEngine()

Abstract constructor

Members

(readonly) id :string

The unique identifier of the Engine. This usually consists of the engine type/name and starts with a capital letter: Native, Twilio, WebRTC, Facebook, Twitter, etc

Type:
  • string

(readonly) id :string

The unique identifier of the Engine. This usually consists of the engine type/name and starts with a capital letter: Native, Twilio, WebRTC, Facebook, Twitter, etc

Type:
  • string

(readonly) id :string

The unique identifier of the Engine. This usually consists of the engine type/name and starts with a capital letter: Native, Twilio, WebRTC, Facebook, Twitter, etc

Type:
  • string

Methods

(abstract, static) probe() → {boolean}

Verify if the engine can be used by the caller of the method. Implementations of this method usually check if the current environment is campatible with the specific media engine. For instance, a WebRTC media engine would check is the code is running in a WebRTC-capable browser. The function must be synchronous.

Returns:
  • true means the engine can be used.
Type
boolean

restore(currentMedia, newMedia) → {MediaEngineTransitResult}

Called when Vivocha is trying to restore a previous media state and a transition is required. This typically happens when a user move between pages of a website and Vivocha needs to restore the media state of the user. The default implementation simply calls transit. Some media engines might need to differentiate a restore from a normal transit, for instance to avoid asking again the user to authorize the access to the microphone.

Parameters:
Name Type Description
currentMedia MediaState

The current media state

newMedia MediaState

The state the media must transit to

Returns:
  • Resolved, when the transition is complete, to a MediaState, usually a reference to currentMedia.
Type
MediaEngineTransitResult

(abstract, static) probe() → {boolean}

Verify if the engine can be used by the caller of the method. Implementations of this method usually check if the current environment is campatible with the specific media engine. For instance, a WebRTC media engine would check is the code is running in a WebRTC-capable browser. The function must be synchronous.

Returns:
  • true means the engine can be used.
Type
boolean

restore(currentMedia, newMedia) → {MediaEngineTransitResult}

Called when Vivocha is trying to restore a previous media state and a transition is required. This typically happens when a user move between pages of a website and Vivocha needs to restore the media state of the user. The default implementation simply calls transit. Some media engines might need to differentiate a restore from a normal transit, for instance to avoid asking again the user to authorize the access to the microphone.

Parameters:
Name Type Description
currentMedia MediaState

The current media state

newMedia MediaState

The state the media must transit to

Returns:
  • Resolved, when the transition is complete, to a MediaState, usually a reference to currentMedia.
Type
MediaEngineTransitResult

(abstract, static) probe() → {boolean}

Verify if the engine can be used by the caller of the method. Implementations of this method usually check if the current environment is campatible with the specific media engine. For instance, a WebRTC media engine would check is the code is running in a WebRTC-capable browser. The function must be synchronous.

Returns:
  • true means the engine can be used.
Type
boolean

restore(currentMedia, newMedia) → {MediaEngineTransitResult}

Called when Vivocha is trying to restore a previous media state and a transition is required. This typically happens when a user move between pages of a website and Vivocha needs to restore the media state of the user. The default implementation simply calls transit. Some media engines might need to differentiate a restore from a normal transit, for instance to avoid asking again the user to authorize the access to the microphone.

Parameters:
Name Type Description
currentMedia MediaState

The current media state

newMedia MediaState

The state the media must transit to

Returns:
  • Resolved, when the transition is complete, to a MediaState, usually a reference to currentMedia.
Type
MediaEngineTransitResult

A Media Engine is a plugin that can handle transitions of one or more media types using a specific implementation of the media. The buildin media types of Vivocha are chat, audio and video: possible examples of MediaEngines include a Facebook chat handler, a Skype audio/video handler, a SMS chat engine. The MediaEngine is a pure virtual class (similar to a Java interface): it must be derived (extended) to used and all its methods must be overridden.

Table of Contents

Constructor

new MediaEngine()

Abstract constructor

Members

(readonly) id :string

The unique identifier of the Engine. This usually consists of the engine type/name and starts with a capital letter: Native, Twilio, WebRTC, Facebook, Twitter, etc

Type:
  • string

(readonly) id :string

The unique identifier of the Engine. This usually consists of the engine type/name and starts with a capital letter: Native, Twilio, WebRTC, Facebook, Twitter, etc

Type:
  • string

(readonly) id :string

The unique identifier of the Engine. This usually consists of the engine type/name and starts with a capital letter: Native, Twilio, WebRTC, Facebook, Twitter, etc

Type:
  • string

Methods

(abstract, static) probe() → {boolean}

Verify if the engine can be used by the caller of the method. Implementations of this method usually check if the current environment is campatible with the specific media engine. For instance, a WebRTC media engine would check is the code is running in a WebRTC-capable browser. The function must be synchronous.

Returns:
  • true means the engine can be used.
Type
boolean

restore(currentMedia, newMedia) → {MediaEngineTransitResult}

Called when Vivocha is trying to restore a previous media state and a transition is required. This typically happens when a user move between pages of a website and Vivocha needs to restore the media state of the user. The default implementation simply calls transit. Some media engines might need to differentiate a restore from a normal transit, for instance to avoid asking again the user to authorize the access to the microphone.

Parameters:
Name Type Description
currentMedia MediaState

The current media state

newMedia MediaState

The state the media must transit to

Returns:
  • Resolved, when the transition is complete, to a MediaState, usually a reference to currentMedia.
Type
MediaEngineTransitResult

(abstract, static) probe() → {boolean}

Verify if the engine can be used by the caller of the method. Implementations of this method usually check if the current environment is campatible with the specific media engine. For instance, a WebRTC media engine would check is the code is running in a WebRTC-capable browser. The function must be synchronous.

Returns:
  • true means the engine can be used.
Type
boolean

restore(currentMedia, newMedia) → {MediaEngineTransitResult}

Called when Vivocha is trying to restore a previous media state and a transition is required. This typically happens when a user move between pages of a website and Vivocha needs to restore the media state of the user. The default implementation simply calls transit. Some media engines might need to differentiate a restore from a normal transit, for instance to avoid asking again the user to authorize the access to the microphone.

Parameters:
Name Type Description
currentMedia MediaState

The current media state

newMedia MediaState

The state the media must transit to

Returns:
  • Resolved, when the transition is complete, to a MediaState, usually a reference to currentMedia.
Type
MediaEngineTransitResult

(abstract, static) probe() → {boolean}

Verify if the engine can be used by the caller of the method. Implementations of this method usually check if the current environment is campatible with the specific media engine. For instance, a WebRTC media engine would check is the code is running in a WebRTC-capable browser. The function must be synchronous.

Returns:
  • true means the engine can be used.
Type
boolean

restore(currentMedia, newMedia) → {MediaEngineTransitResult}

Called when Vivocha is trying to restore a previous media state and a transition is required. This typically happens when a user move between pages of a website and Vivocha needs to restore the media state of the user. The default implementation simply calls transit. Some media engines might need to differentiate a restore from a normal transit, for instance to avoid asking again the user to authorize the access to the microphone.

Parameters:
Name Type Description
currentMedia MediaState

The current media state

newMedia MediaState

The state the media must transit to

Returns:
  • Resolved, when the transition is complete, to a MediaState, usually a reference to currentMedia.
Type
MediaEngineTransitResult

A Media Engine is a plugin that can handle transitions of one or more media types using a specific implementation of the media. The buildin media types of Vivocha are chat, audio and video: possible examples of MediaEngines include a Facebook chat handler, a Skype audio/video handler, a SMS chat engine. The MediaEngine is a pure virtual class (similar to a Java interface): it must be derived (extended) to used and all its methods must be overridden.

Table of Contents

Constructor

new MediaEngine()

Abstract constructor

Members

(readonly) id :string

The unique identifier of the Engine. This usually consists of the engine type/name and starts with a capital letter: Native, Twilio, WebRTC, Facebook, Twitter, etc

Type:
  • string

(readonly) id :string

The unique identifier of the Engine. This usually consists of the engine type/name and starts with a capital letter: Native, Twilio, WebRTC, Facebook, Twitter, etc

Type:
  • string

(readonly) id :string

The unique identifier of the Engine. This usually consists of the engine type/name and starts with a capital letter: Native, Twilio, WebRTC, Facebook, Twitter, etc

Type:
  • string

Methods

(abstract, static) probe() → {boolean}

Verify if the engine can be used by the caller of the method. Implementations of this method usually check if the current environment is campatible with the specific media engine. For instance, a WebRTC media engine would check is the code is running in a WebRTC-capable browser. The function must be synchronous.

Returns:
  • true means the engine can be used.
Type
boolean

restore(currentMedia, newMedia) → {MediaEngineTransitResult}

Called when Vivocha is trying to restore a previous media state and a transition is required. This typically happens when a user move between pages of a website and Vivocha needs to restore the media state of the user. The default implementation simply calls transit. Some media engines might need to differentiate a restore from a normal transit, for instance to avoid asking again the user to authorize the access to the microphone.

Parameters:
Name Type Description
currentMedia MediaState

The current media state

newMedia MediaState

The state the media must transit to

Returns:
  • Resolved, when the transition is complete, to a MediaState, usually a reference to currentMedia.
Type
MediaEngineTransitResult

(abstract, static) probe() → {boolean}

Verify if the engine can be used by the caller of the method. Implementations of this method usually check if the current environment is campatible with the specific media engine. For instance, a WebRTC media engine would check is the code is running in a WebRTC-capable browser. The function must be synchronous.

Returns:
  • true means the engine can be used.
Type
boolean

restore(currentMedia, newMedia) → {MediaEngineTransitResult}

Called when Vivocha is trying to restore a previous media state and a transition is required. This typically happens when a user move between pages of a website and Vivocha needs to restore the media state of the user. The default implementation simply calls transit. Some media engines might need to differentiate a restore from a normal transit, for instance to avoid asking again the user to authorize the access to the microphone.

Parameters:
Name Type Description
currentMedia MediaState

The current media state

newMedia MediaState

The state the media must transit to

Returns:
  • Resolved, when the transition is complete, to a MediaState, usually a reference to currentMedia.
Type
MediaEngineTransitResult

(abstract, static) probe() → {boolean}

Verify if the engine can be used by the caller of the method. Implementations of this method usually check if the current environment is campatible with the specific media engine. For instance, a WebRTC media engine would check is the code is running in a WebRTC-capable browser. The function must be synchronous.

Returns:
  • true means the engine can be used.
Type
boolean

restore(currentMedia, newMedia) → {MediaEngineTransitResult}

Called when Vivocha is trying to restore a previous media state and a transition is required. This typically happens when a user move between pages of a website and Vivocha needs to restore the media state of the user. The default implementation simply calls transit. Some media engines might need to differentiate a restore from a normal transit, for instance to avoid asking again the user to authorize the access to the microphone.

Parameters:
Name Type Description
currentMedia MediaState

The current media state

newMedia MediaState

The state the media must transit to

Returns:
  • Resolved, when the transition is complete, to a MediaState, usually a reference to currentMedia.
Type
MediaEngineTransitResult