Namespace: Session

Session

Represents connection to REST App. Can create and store Streams.
Source:
See:

Methods

(static) getLogger() → {Object}

Get session logger
Source:
Returns:
Logger
Type
Object

(inner) createCall(options, sdpHook) → {Call}

Create call.
Parameters:
Name Type Description
options Object Call options
Properties
Name Type Attributes Description
callee string Call remote party id
visibleName string <optional>
Call caller visible name
constraints Object Call constraints
mediaProvider string MediaProvider type to use with this call
receiveAudio Boolean <optional>
Receive audio
receiveVideo Boolean <optional>
Receive video
cacheLocalResources Boolean <optional>
Display will contain local video after call release
localVideoDisplay HTMLElement Div element local video should be displayed in
remoteVideoDisplay HTMLElement Div element remote video should be displayed in
custom Object <optional>
User provided custom object that will be available in REST App code
stripCodecs string <optional>
Comma separated strings of codecs which should be stripped from WebRTC SDP (ex. "SILK,G722")
sipSDP Array.<string> <optional>
Array of custom SDP params (ex. bandwidth (b=))
sipHeaders Array.<string> <optional>
Array of custom SIP headers
videoContentHint string <optional>
Video content hint for browser ('detail' by default to maintain resolution), Flashphoner.constants.CONTENT_HINT_TYPE
useControls Boolean <optional>
Use a standard HTML5 video controls (play, pause, fullscreen). May be a workaround for fullscreen mode to work in Safari 16
logger Object <optional>
Call logger options
sdpHook sdpHook The callback that handles sdp from the server
Source:
Throws:
  • Error if no options provided
    Type
    TypeError
  • Error if session state is not REGISTERED
    Type
    Error
Returns:
Call
Type
Call

(inner) createStream(options, sdpHook) → {Stream}

Create stream.
Parameters:
Name Type Description
options Object Stream options
Properties
Name Type Attributes Default Description
name string Stream name
constraints Object <optional>
Stream constraints
Properties
Name Type Attributes Default Description
audio Boolean | Object <optional>
true Specifies if published stream should have audio. Played stream always should have audio: the property should not be set to false in that case.
Properties
Name Type Attributes Description
outputId string <optional>
Set width to publish or play stream with this value
video Boolean | Object <optional>
true Specifies if published or played stream should have video, or sets video constraints
Properties
Name Type Attributes Default Description
width Integer <optional>
0 Set width to publish or play stream with this value
height Integer <optional>
0 Set height to publish or play stream with this value
bitrate Integer <optional>
0 DEPRECATED FOR PUBLISH: Set bitrate to publish or play stream with this value
minBitrate Integer <optional>
0 Set minimal bitrate to publish stream with this value
maxBitrate Integer <optional>
0 Set maximal bitrate to publish stream with this value
quality Integer <optional>
0 Set quality to play stream with this value
customStream MediaStream <optional>
Set a MediaStream for publish stream from canvas.
receiveAudio Boolean <optional>
DEPRECATED: Receive audio
receiveVideo Boolean <optional>
DEPRECATED: Receive video
playWidth Integer <optional>
DEPRECATED: Set width to play stream with this value
playHeight Integer <optional>
DEPRECATED: Set height to play stream with this value
mediaProvider string <optional>
MediaProvider type to use with this stream
record Boolean <optional>
false Enable stream recording
cacheLocalResources Boolean <optional>
Display will contain local video after stream release
display HTMLElement Div element stream should be displayed in
custom Object <optional>
User provided custom object that will be available in REST App code
flashBufferTime Integer <optional>
0 Specifies how long to buffer messages before starting to display the stream (Flash-only)
stripCodecs string <optional>
Comma separated string of codecs which should be stripped from WebRTC SDP (ex. "H264,PCMA,PCMU,G722")
rtmpUrl string <optional>
Rtmp url stream should be forwarded to
mediaConnectionConstraints Object <optional>
Stream specific constraints for underlying RTCPeerConnection
flashShowFullScreenButton Boolean <optional>
Show full screen button in flash
transport string <optional>
Transport to be used by server for WebRTC media, Flashphoner.constants.TRANSPORT_TYPE
cvoExtension Boolean <optional>
Enable rtp video orientation extension
playoutDelay Integer <optional>
Time delay between network reception of media and playout
useCanvasMediaStream string <optional>
EXPERIMENTAL: when publish bind browser's media stream to the canvas. It can be useful for image filtering
videoContentHint string <optional>
Video content hint for browser ('detail' by default to maintain resolution), Flashphoner.constants.CONTENT_HINT_TYPE
unmutePlayOnStart Boolean <optional>
Unmute playback on start. May be used after user gesture only, so set 'unmutePlayOnStart: false' for autoplay
useControls Boolean <optional>
Use a standard HTML5 video controls (play, pause, fullscreen). May be a workaround for fullscreen mode to work in Safari 16
logger Object <optional>
Stream logger options
sdpHook sdpHook The callback that handles sdp from the server
Source:
Throws:
  • Error if no options provided
    Type
    TypeError
  • Error if options.name is not specified
    Type
    TypeError
  • Error if session state is not ESTABLISHED
    Type
    Error
Returns:
Stream
Type
Stream

(inner) disconnect()

Disconnect session.
Source:

(inner) getServerUrl() → {string}

Get server address
Source:
Returns:
Server url
Type
string

(inner) getStream(streamId) → {Stream}

Get stream by id.
Parameters:
Name Type Description
streamId string Stream id
Source:
Returns:
Stream
Type
Stream

(inner) getStreams() → {Array.<Stream>}

Get streams.
Source:
Returns:
Streams
Type
Array.<Stream>

(inner) id() → {string}

Get session id
Source:
Returns:
session id
Type
string

(inner) on(event, callback) → {Session}

Add session event callback.
Parameters:
Name Type Description
event string One of Flashphoner.constants.SESSION_STATUS events
callback Session~eventCallback Callback function
Source:
Throws:
  • Error if event is not specified
    Type
    TypeError
  • Error if callback is not a valid function
    Type
    Error
Returns:
Session
Type
Session

(inner) sendData(data) → {Promise}

Send data to REST App
Parameters:
Name Type Description
data Object Object to send
Source:
Returns:
Resolves if data accepted, otherwise rejects
Type
Promise

(inner) startDebug()

Start session debug
Source:

(inner) status() → {string}

Get session status
Source:
Returns:
Type
string

(inner) stopDebug()

Stop session debug
Source:

(inner) submitBugReport(reportObject)

Submit bug report.
Parameters:
Name Type Description
reportObject Object Report object
Source:

Type Definitions

eventCallback(session)

Session event callback.
Parameters:
Name Type Description
session Session Session that corresponds to the event
Source: