- Source:
Methods
(static) createSession(options) → {Session}
Create new session and connect to server.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Session options
Properties
|
- Source:
Throws:
-
-
Error if API is not initialized
- Type
- Error
-
-
-
Error if options.urlServer is not specified
- Type
- TypeError
-
Returns:
Created session
- Type
- Session
(static) getLogger() → {Object}
Get core logger
- Source:
Returns:
Logger
- Type
- Object
(static) getMediaAccess(constraints, display, mediaProvider, disableConstraintsNormalization) → {Promise.<HTMLElement>}
Get access to local media
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
constraints |
Object | Media constraints
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||
display |
HTMLElement | Div element local media should be displayed in | |||||||||||||||||||||||||||||||||||||||||||||
mediaProvider |
String | Media provider type | |||||||||||||||||||||||||||||||||||||||||||||
disableConstraintsNormalization |
Boolean | Disable constraints normalization |
- Source:
Throws:
-
Error if API is not initialized
- Type
- Error
Returns:
Promise with display on fulfill
- Type
- Promise.<HTMLElement>
(static) getMediaDevices(mediaProvideropt, labelsopt, kind, deviceConstraintsopt) → {Promise.<Flashphoner.MediaDeviceList>}
Get available local media devices
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
mediaProvider |
String |
<optional> |
Media provider that will be asked for device list |
labels |
Boolean |
<optional> |
Ask user for microphone access before getting device list. This will make device label available. |
kind |
Flashphoner.constants.MEDIA_DEVICE_KIND | Media devices kind to access: MEDIA_DEVICE_KIND.INPUT (default) get access to input devices only (camera, mic). MEDIA_DEVICE_KIND.OUTPUT get access to output devices only (speaker, headphone). MEDIA_DEVICE_KIND.ALL get access to all devices (cam, mic, speaker, headphone). | |
deviceConstraints |
Object |
<optional> |
If labels == true. If {audio: true, video: false}, then access to the camera will not be requested. If {audio: false, video: true}, then access to the microphone will not be requested. |
- Source:
Throws:
-
Error if API is not initialized
- Type
- Error
Returns:
Promise with media device list on fulfill
- Type
- Promise.<Flashphoner.MediaDeviceList>
(static) getMediaProviders() → {Array}
Get available MediaProviders.
- Source:
Returns:
Available MediaProviders
- Type
- Array
(static) getSession(id) → {Session}
Get session by id.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | Session id |
- Source:
Returns:
Session
- Type
- Session
(static) getSessions() → {Array.<Session>}
Get active sessions.
- Source:
Returns:
Array containing active sessions
- Type
- Array.<Session>
(async, static) init(options)
Static initializer.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Global api options
Properties
|
- Source:
Throws:
-
Error if none of MediaProviders available
- Type
- Error
(static) playFirstSound(noise)
Play audio chunk
Parameters:
Name | Type | Description |
---|---|---|
noise |
boolean | Use noise in playing |
- Source:
(static) playFirstVideo()
Play video chunk
- Source:
(static) releaseLocalMedia(display, mediaProvideropt) → {Boolean}
Release local media
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
display |
HTMLElement | Div element with local media | |
mediaProvider |
String |
<optional> |
Media provider type |
- Source:
Throws:
-
Error if API is not initialized
- Type
- Error
Returns:
True if media was found and released
- Type
- Boolean
Type Definitions
MediaDevice
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
type |
String | Type of device: mic, camera, screen |
id |
String | Unique id |
label |
String | Device label |
- Source:
MediaDeviceList
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
audio |
Array.<Flashphoner.MediaDevice> | Audio devices (microphones) |
video |
Array.<Flashphoner.MediaDevice> | Video devices (cameras) |
- Source: