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