Namespace: Flashphoner

Flashphoner

Methods

(static) createSession(options) → {Session}

Create new session and connect to server.
Parameters:
Name Type Description
options Object Session options
Properties
Name Type Attributes Description
urlServer string Server address in form of [ws,wss]://host.domain:port
authToken string Token for auth on server with keepalived client
keepAlive Boolean <optional>
Keep alive client on server after disconnect
lbUrl string <optional>
Load-balancer address
flashProto string <optional>
Flash protocol [rtmp,rtmfp]
flashPort Integer <optional>
Flash server port [1935]
appKey string <optional>
REST App key
custom Object <optional>
User provided custom object that will be available in REST App code
sipOptions Object <optional>
Sip configuration
mediaOptions Object <optional>
Media connection configuration
timeout Integer <optional>
Connection timeout in milliseconds
pingInterval Integer <optional>
Server ping interval in milliseconds [0]
receiveProbes Integer <optional>
A maximum subsequental pings received missing count [0]
probesInterval Integer <optional>
Interval to check subsequental pings received [0]
logger Object <optional>
Session logger options
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
Name Type Description
audio Object Audio constraints
Properties
Name Type Attributes Description
deviceId String <optional>
Audio device id
video Object Video constraints
Properties
Name Type Attributes Description
deviceId String <optional>
Video device id
width number Video width
height number Video height
frameRate number Video fps
type String Video device type: camera, screen
mediaSource String Video source type for FF: screen, window
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>

(static) init(options)

Static initializer.
Parameters:
Name Type Description
options Object Global api options
Properties
Name Type Attributes Description
mediaProvidersReadyCallback function <optional>
Callback of initialized WebRTC Plugin
flashMediaProviderSwfLocation String <optional>
Location of media-provider.swf file
preferredMediaProvider string <optional>
DEPRECATED: Use preferred media provider if available
preferredMediaProviders Array <optional>
Use preferred media providers order
receiverLocation String <optional>
Location of WSReceiver.js file
decoderLocation String <optional>
Location of video-worker2.js file
screenSharingExtensionId String <optional>
Chrome screen sharing extension id
constraints Object <optional>
Default local media constraints
logger Object <optional>
Core logger options
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: