Members
Base64
Base64 encode / decode
http://www.webtoolkit.info/
CommunicationStability
This singleton monitors the stability of the communication between the Web Client and the Mobile Server.
Such kind of monitoring is necessary due to the limitation of the simultaneous AJAX requests that the server can process.
The server gets constantly overloaded when the Web Client shows many cameras on the screen or/and there are many Web Clients connected to the same Mobile Server.
When the server is overloaded, some/all of the HTTP requests fail with different HTTP error codes, HTTP error 0 (zero) being the most frequent one.
In such situations, the AJAX requests should become less frequent, i.e. the interval between requesting frames for streams should get bigger.
Also, the LiveMessage command should always be with higher priority than the video stream requests to avoid log-out. Loosely speaking, the command channel
should be with higher priority than the video channel.
This singleton modifies the variables declared in the NETWORK object. NETWORK.requestTime is probably the most important, as it defines the interval between two
requests for video frames. The general rule is that if the communication is overloaded, the requestTime interval is bigger, so the server gets a chance to recover.
Date
UTC time when challenge received
(constant) FrameHeaders
Video frame header and flags definition
NETWORK
Network parameters - see CommunicationStability.
(constant) VideoConnectionState
Video connection state definition
destroy
Executes to clean up all of the audio parameters.
integer
Time to live constant - in seconds
playback :Number
Type:
- Number
startAudioStream
Executes to start audio.
stopAudioStream
Executes to stop audio.
Methods
ChangeStream(params, successCallback, failCallback)
Sends a ChangeStream connection command and logs out the current user.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. May contain:
- {String} ConnectionId - Connection ID retrieved from Connect command - {String} VideoId - ID of the video connection (GUID) - {Number} DestWidth - (optional) Width of the requested video (in pixels) - {Number} DestHeight - (optional) Height of the requested video (in pixels) - {Number} Fps - (optional) Frame-rate of the requested video (frames per second) - {Number} ComprLevel - (optional) Compression level of the received JPEG images (1 - 100) - {String} MethodType - Type of the method for retrieving video data - Push or Pull - {String} SeekType - (optional) Makes seek of specific type: DbStart, DbEnd, PrevSeq, NextSeq, PrevFrame, NextFrame, Time, TimeOrBefore, TimeOrAfter, TimeAfter, TimeBefore. - {String} Time - (optional) Time of playback speed (in milliseconds since Unix epoch). Valid if SeekType == Time. - {String} SignalType - Type of the requested signal - Live, Playback or Upload. - {Number} SrcLeft - (optional) Left coordinate (X) of the cropping rectangle. - {Number} SrcTop - (optional) Top coordinate (Y) of the cropping rectangle. - {Number} SrcRight - (optional) Right coordinate (X) of the cropping rectangle. - {Number} SrcBottom - (optional) Bottom coordinate (Y) of the cropping rectangle. - {Number} Speed - (optional) Speed of the playback (floating point). Sign determines the direction. - {Number} PtzPreset - (optional) Makes move of the PTZ to a user defined preset. - {String} RegionGrid - (reserved) - {String} MotionOverlayEnabled - (reserved) No/Yes - {Number} MotionAmount - (reserved ) 1-100 - {Number} SensitivityAmount - (reserved) 1-100 - {Number} CPUImpactAmont - (reserved) 1-4 - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default depends on the value in connect command |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
CloseStream(params, successCallback, failCallback)
Sends a CloseStream connection command and logs out the current user.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. Should contain:
- {String} ConnectionId - Connection ID retrieved from Connect command - {String} VideoId - ID of the video connection (GUID) - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default depends on the value in connect command |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Connect(params, successCallback, failCallback) → {ConnectionRequest}
Initiates connection to the Mobile Server. Two limitations are introduced:
MaximumConnectionAllowed and ConnectionTimeout between Connect and Login.
They are set from the GeneralSetting section in config file
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. May contain:
- {String} EncryptionPadding - (optional) Padding scheme that will be used when encrypting/decrypting shared key. Default is PKCS7. Currently supported values are PKCS7 and ISO10126. - {Number} PrimeLength - (optional) The length of the prime module in bits. Default is 1024. Currently supported values are 1024 and 2048 - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default is Yes. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
CreateBookmark(params, successCallback, errorCallback)
Create a bookmark for the specific device
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the server. Can contain:
- {String} VideoID (optional) - Id of the stream to bookmark (Guid), If it's not provided, CameraId, Name and Time are considered mandatory. - {String} CameraId (mandatory) - Id of the camera to bookmark (Guid). - {String} Name (mandatory) - Name of the bookmark - {String} Description (optional) - Bookmark description. "Mobile bookmark" will be used if input param is empty. - {String} Time (mandatory) - Exact time of the bookmark (milliseconds since Unix epoch). - {String} StartTime (optional) - Start time of the bookmark (milliseconds since Unix epoch). - {String} EndTime (optional) - End time of the bookmark (milliseconds since Unix epoch). |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Disconnect(params, successCallback, failCallback)
Sends a Disconnect connection command and logs out the current user.
(Stops all the open video communication channels, removes ConnectionId from the internal resolving mechanism)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. May contain:
- {String} ConnectionId - Connection ID retrieved from Connect command - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default depends on the value in connect command. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
ExternalLogin(params, successCallback, failCallback) → {ConnectionRequest}
Sends a low level Login command to the server.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. May contain:
- {String} IdpClientId - Name of the client IDP - {String} IdentityToken - Identity toke provider from 3rd party login - {String} AccessToken - Access token provider from 3rd party login - {String} RefreshToken - Refresh token provider from 3rd party login - {String} LoginType - Authentication login type. - {Number} NumChallenges - Number of challenges the MoS should return. Up to 100 can be requested at once. - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default is Yes. - {String} SupportsResampling - (optional) [Yes/No] When present and equal to "Yes", indicates that the client can handle downsized images. This instructs Quality of Service to reduce the size of the sent images as additional measure in cases of low bandwidth. - {String} SupportsExtendedResamplingFactor - (optional) [Yes/No] When present and equal to "Yes", indicates that client supports working with decimal resampling factor. Influence on the type of ResamplingTag received in Header Extension Flags of Video frame |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
GetBookmarks(params, successCallback, failCallback)
Gets a list of bookmarks. There are 3 valid usages of the command.
The first one is to provide Count in order to retrieve only the latest bookmarks.
The second one is to provide BookmarkId in order to retrieve a single bookmark.
And the last one is to get a list of bookmarks searching from specified bookmark - than BookmarkId and Count should be provided.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. May contain:
- {String} BookmarkId - GUID of the Bookmark. If specified along with Count, StartTime will be ignored and the Bookmark will be considered as a start time of the search interval. If only BookmarkId is specified than single bookmark will be returned as a result - {Number} Count - Maximum number of bookmarks to be returned in the result. If you want to retrieve a specific bookmark you should not specify the count, but provide the BookmarkId only. - {String} StartTime - (Optional) Start time of the search interval. It specifies from where the search of bookmark will begin. If not specified current time will be considered as a start time. - {String} EndTime - (Optional) End time of the search interval. If the EndTime is set before the StartTime than the bookmarks will be returned in reversed order again starting to search from StartTime to EndTime. - {String} MyBookmarks - (Optional)YES/NO - flag whether to send only my Bookmarks - {String} Keyword - (Optional)Search string to appear in either of the fields 'Reference', 'Header', 'Description' - {String} SearchCameraIds - (Optional) Included cameras GUIDs in a comma separated string |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
LiveMessage(params, successCallback, failCallback)
Sends a LiveMessage command to the server indicating that the client is up and running. Client needs to send that command at least once in the watch dog interval which is 30 seconds by default.
Recomented interval is 80% of whach dog = 80*30/100 = 24
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. May contain:
- {String} ConnectionId - Connection ID retrieved from Connect command - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default depends on the value in connect command. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Example
setInterval(function(){XPMobileSDK.LiveMessage()}, 24000);
Login(params, successCallback, failCallback) → {ConnectionRequest}
Sends a low level Login command to the server.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. May contain:
- {String} Username - Name of the connection user. - {String} Password - Password for the certain user. - {String} LoginType - Authentication login type. - {Number} NumChallenges - Number of challenges the MoS should return. Up to 100 can be requested at once. - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default is Yes. - {String} SupportsResampling - (optional) [Yes/No] When present and equal to "Yes", indicates that the client can handle downsized images. This instructs Quality of Service to reduce the size of the sent images as additional measure in cases of low bandwidth. - {String} SupportsExtendedResamplingFactor - (optional) [Yes/No] When present and equal to "Yes", indicates that client supports working with decimal resampling factor. Influence on the type of ResamplingTag received in Header Extension Flags of Video frame |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
RegisterForNotifications(settings, successCallback, errorCallback) → {ConnectionRequest}
Register or update client notifications subscription with specified settings
Parameters:
Name | Type | Description |
---|---|---|
settings |
Number | Settings mask indicating whether the subscriber should recieve notification and what type of notifications will be send. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
RegisterForNotifications(params, successCallback, errorCallback)
Register or update client notifications subscription with specified settings
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the server. Can contain:
- {String} DeviceId - The ID of the notifications subscriber. - {String} DeviceName - Humanly readable device identifier. Expected to be encrypted - {Number} Settings - Settings mask indicating whether the subscriber should recieve notification and what type of notifications will be send. - {String} OptionalParamX - Humanly readable device identifier - {String} OptionalParamY - Humanly readable device identifier - {String} OptionalParamZ - Humanly readable device identifier |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
RequestAudioStream(params, successCallback, failCallback)
Starts live, playback audio session for a particular device.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. May contain:
- {String} ConnectionId - Connection ID retrieved from Connect command - {String} StreamType - Shows if this is a transcoded or a direct stream. Possible values - Transcoded. Missing of this will be interpreted as Transcoded. (backward compatibility) - {String} ItemId - ID of the microphone, which stream is requested (GUID) - {Number} ComprLevel - Compression level of the received Audio (1 - 100) - {String} SignalType - Type of the requested signal - Live, Playback or Upload. - {String} MethodType - Type of the method for retrieving video data - Push or Pull - {String} StreamDataType - "Audio" - {String} AudioEncoding - Shows the encoding of the output. Possible values - Pcm, Mp3. - {String} CloseConnectionOnError - (optional) Yes/No - decide what to do with the connection channel on error. - {String} PlaybackControllerId - (optional) Id of the playback controller used for common playback control. Use an ID of a video stream with which the audio source is associated. When present and not equal to empty string, indicates that the client requires playback controller to be used, shared between the audio and video playback streams. Valid only if "SignalType" is set to Playback. If not present - no playback audio stream is created. If set to invalid id - error is returned (unknown item id - 21). - {String} ByteOrder - LittleEndian/Network. Missing of this will be interpreted as LittleEndian for Transcoded StreamType and Network for Native StreamType. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
RequestAudioStreamIn(params, successCallback, errorCallback) → {ConnectionRequest}
Sends a RequestAudioStreamIn connection command to get an upstream for audio push to the server.
Parameters:
Name | Type | Description |
---|---|---|
params |
AudioConnectionOptions | Configuration. Should contain:
- {String} itemId - Id of the item (speaker), which stream is requested (GUID) - {String} AudioEncoding - Shows the encoding of the output. Possible values - Pcm, Mp3. - {Number} AudioSamplingRate - The audio sampling rate in Hz value - {Number} AudioBitsPerSample - 8/16 - Audio bits per sample - {Number} AudioChannelsNumber - 1/2 - Number of audio channels (mon or stereo) - {String} StreamDataType - Shows if this is video, audio or metadata. Possible values - Video, Audio, MetaData. - {String} SignalType - Type of the requested signal - Live, Playback - {String} MethodType - Type of the method for retrieving video data - Push or Pull - {String} StreamHeaders - Shows available stream headers. Possible values - AllPresent, NoHeaders. - {String} Challenge - (only if CHAPSupproted is true) GUID previously given by the server - {String} ChalAnswer - (only if CHAPSupproted is true) Challenge itself plus a SHA512 hash encoded as base64 |
successCallback |
function | function that is called when the command execution was successful and a stream parameters object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
RequestBookmarkCreation(params, successCallback, errorCallback)
Get information about bookmark like pre/post time and reserve reference for its creation which can be used after that
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the server. Can contain:
- {String} CameraId - Id of the camera to bookmark (Guid). |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
RequestStream(params, successCallback, failCallback)
Starts live, payback or push video session for a particular device.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters to sent to the server. May contain:
- {String} ConnectionId - Connection ID retrieved from Connect command - {String} StreamType - Shows if this is a transcoded or a direct stream. Possible values - Native and Transcoded. Missing of this will be interpreted as Transcoded. (backward compatibility) - {String} ByteOrder - LittleEndian/Network. Missing of this will be interpreted as LittleEndian for Transcoded, StreamType and Network for Native StreamType. - {String} CameraId - ID of the camera, which stream is requested (GUID) - {Number} DestWidth - Width of the requested video (in pixels) - {Number} DestHeight - Height of the requested video (in pixels) - {Number} Fps - Frame-rate of the requested video (frames per second) - {Number} ComprLevel - Compression level of the received JPEG images (1 - 100) - {String} SignalType - Type of the requested signal - Live, Playback or Upload. - {String} MethodType - Type of the method for retrieving video data - Push or Pull - {String} KeyFramesOnly - Yes/No (everything different than Yes is interpreted as No) - reduces stream quality by transcoding only Key (I) frames, if option is enabled in the Management Plug-in. - {String} TImeRestrictionStart - (optional) Start time stamp of restriction period given as milliseconds since Unix EPOCH - {String} TimeRestrictionEnd - (optional) End time stamp of restriction period given as milliseconds since Unix EPOCH - {String} MotionOverlay - (reserved) No/Yes - {String} RequestSize - (optional) [Yes/No] - If value of the field is Yes, Size header extension is sent with every frame. Otherwise it is sent only on size change. Missing of paramter is interpreted as No. - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default is Yes. - {String} SeekType - (optional) Makes seek of specific type: DbStart, DbEnd, PrevSeq, NextSeq, PrevFrame, NextFrame, Time, TimeOrBefore, TimeOrAfter, TimeAfter, TimeBefore. - {String} Time - (optional) Time of playback speed (in milliseconds since Unix epoch). Valid if SeekType == Time. - {String} UserInitiatedDownsampling - (optional) [Yes/No] When present and equal to "Yes", indicates that the client requires all sent images to be downsized at least by two (half the requested width and height). SupportsResampling must be set explicitly to "Yes". - {String} PlaybackControllerId - (optional) Id of the playback controller used for common playback control. Received from "CreatePlaybackController" command. When present and not equal to empty string, indicates that the client requires playback controller to be used, shared between few playback streams. Valid only if "SignalType" is set to Playback. If does not present - single playback stream is created. If set to id of the existing in the server controller - this playback stream is attached to it. If set to invalid id - error is returned (unknown item id - 21). |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
UpdateBookmark(params, successCallback, errorCallback)
Update a bookmark for the specific device
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the server. Can contain:
- {String} BookmarkId (mandatory) - Id of an existing bookmark which is to be modified (Guid). - {String} Name (optional) - Name of the bookmark - {String} Description (optional) - Bookmark description. "Mobile bookmark" will be used if input param is empty. - {String} Time (optional) - Exact time of the bookmark (milliseconds since Unix epoch). - {String} StartTime (optional) - Start time of the bookmark (milliseconds since Unix epoch). - {String} EndTime (optional) - End time of the bookmark (milliseconds since Unix epoch). |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
acknowledgeAlarm(alarmId, successCallback, errorCallback) → {ConnectionRequest}
Acknowledges a given alarm.
Parameters:
Name | Type | Description |
---|---|---|
alarmId |
String | Id of the Alarm to acknowlegde |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
addFragment(fragment)
This method is called each time when new fragment is received.
It monitors the network and checks if the video player have stucked
Parameters:
Name | Type | Description |
---|---|---|
fragment |
object |
addObserver(observer)
Adds an observer for the video connection.
Parameters:
Name | Type | Description |
---|---|---|
observer |
Any object. Should implement methods from the VideoConnectionObserverInterface. |
addObserver(observer)
Adds an observer for the video connection.
Parameters:
Name | Type | Description |
---|---|---|
observer |
Any object. Should implement methods from the VideoConnectionObserverInterface. |
addObserver(observer)
Adds an observer to the Connection singleton.
Parameters:
Name | Type | Description |
---|---|---|
observer |
Object | an arbitrary object implementing the ConnectionObserverInterface interface |
- See:
-
- ConnectionObserverInterface
addObserver(observer)
Adds an observer for the video connection.
Parameters:
Name | Type | Description |
---|---|---|
observer |
Object | Any object. Should implement methods from the VideoConnectionObserverInterface. |
cancel()
Cancels the ajax request.
cancelInvestigation(investigationId) → {ConnectionRequest}
Cancels investigation creation when in progress.
Parameters:
Name | Type | Description |
---|---|---|
investigationId |
Number | Id of the investigation to delete. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
cancelRequest(request)
Cancels a request.
Parameters:
Name | Type | Description |
---|---|---|
request |
ConnectionRequest | the ConnectionRequest object, returned by the method used to create it |
changeMultipleStreams(parameters, successCallback, errorCallback) → {ConnectionRequest}
Change several streams at a time
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {String} PlaybackControllerId - Id of the video connection - {Number} Speed - (optional) Speed of the playback (floating point). Sign determines the direction. - {String} SeekType - (optional) Makes seek of specific type: Time. - {Number} Time - (optional) Time of playback speed (in milliseconds since Unix epoch). Valid if "SeekType == Time" |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
changeStream(videoConnection, cropping, size, successCallback, errorCallback) → {ConnectionRequest}
Sends a ChangeStream connection command to change the parameters of an existing VideoConnection.
Parameters:
Name | Type | Description |
---|---|---|
videoConnection |
VideoConnection | existing VideoConnection object representing a camera stream |
cropping |
VideoConnectionCropping | rectangle to crop from the native camera video stream |
size |
VideoConnectionSize | output stream size for the resulting cropped native camera video stream |
successCallback |
function | function that is called when the command execution was successful. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
checkVideoStuck()
This method calculates if the video player is stucked or not.
close()
Closes the connection.
close()
Closes the connection.
close()
Closes the video push connection
closeAudioStream(streamId) → {ConnectionRequest}
Sends a CloseStream connection command to close an existing Audio stream by Id.
Parameters:
Name | Type | Description |
---|---|---|
streamId |
String | id of an existing stream |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
closeStream(videoId) → {ConnectionRequest}
Sends a CloseStream connection command to close an existing VideoConnection by id.
Parameters:
Name | Type | Description |
---|---|---|
videoId |
String | id of an existing VideoConnection |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
codeException(exception)
Fallback if there is any exception while adding data to the source buffer.
Parameters:
Name | Type | Description |
---|---|---|
exception |
exception |
connect(server) → {ConnectionRequest}
Sends a Connect connection command to establish a new connection with a server.
The changes of the connect status are propagated to all listeners through the ConnectionObserver interface methods.
Listeners implementing the ConnectionObserver interface methods are added with the addObserver method.
Parameters:
Name | Type | Description |
---|---|---|
server |
String | server name or IP address |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
connectWithId(server, connectionId, serverId) → {ConnectionRequest}
Tries to reestablish an existing connection with a server by using an existing connection id.
The changes of the connect status are propagated to all listeners through the ConnectionObserver interface methods.
Listeners implementing the ConnectionObserver interface methods are added with the addObserver method.
Parameters:
Name | Type | Description |
---|---|---|
server |
String | server name or IP address |
connectionId |
String | connection id |
serverId |
String | server id |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
connectionCodeError()
Sent to observers when connection is in the process of logging in, a code has been sent to the server for verification, but this code is wrong.
connectionDidConnect(parameters)
Sent to observers when connection has connected to the server and is about to send credentials
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | the object containing the response parameters. |
connectionDidDisconnect()
Sent to observers when connection to the server was closed on request via disconnect method.
connectionDidLogIn()
Sent to observers when connection has logged in.
connectionFailedToConnect()
Sent to observers when connection attempted to connect to the server but failed.
Note that error may be a null object if we have failed to even parse the response from the server.
connectionFailedToConnectWithId()
Sent to observers when connecting with external connection ID has failed.
connectionFailedToLogIn()
Sent to observers when connection has failed to log in. Check the error to determine if it was due to incorrect credentials!
Note that error may be a null object if we have failed to even parse the response from the server.
connectionLostConnection()
Sent to observers when connection to the server was lost.
connectionProcessingDisconnect()
Sent to observers when the disconnect command is sent.
connectionRequestSucceeded()
Sent to observers every time a request to the server has been received properly and without timeout or other terminal errors.
You can use that to keep track of the connection and monitor it is properly working.
connectionRequiresCode(provider)
Sent to observers when connection is in the process of logging in, but requires additional verification code.
Parameters:
Name | Type | Description |
---|---|---|
provider |
String | the provider used to send a verification code. |
connectionStateChanged()
Sent to observers when the connection state changes in any way
convertToImage()
Encode the data using Blob
createAudioPushConnection(itemIds, sampleRate, successCallback, errorCallback) → {ConnectionRequest}
Establishes a connection to an available web camera speaker and requests an audio push stream for that speaker with RequestAudioStreamIn.
Parameters:
Name | Type | Description |
---|---|---|
itemIds |
Array | array of items we will push audio to. |
sampleRate |
Number | the sample rate at which we send the audio to the server. |
successCallback |
function | function that is called when the command execution was successful and a AudioPushConnection object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
createExportDownloadLink(exportId, investigationId, exportType, successCallback, errorCallback) → {ConnectionRequest}
Gets a disposable export download link by ExportId
Parameters:
Name | Type | Description |
---|---|---|
exportId |
String | ID of the export(GUID). |
investigationId |
String | ID of the investigation(GUID). |
exportType |
String | Type of the export. Possible values: DB, AVI, MKV (the same as for triggering normal exports) |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
createInvestigation(parameters, successCallback, errorCallback) → {ConnectionRequest}
Creates new investigation entry in the server.
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {Number} StartTime - Start time of the investigation (milliseconds since Unix epoch) - {Number} EndTime - End Time of the investigation (milliseconds since Unix epoch) - {String} Name - Name of the investigation. - {String} State - (optional) State of the investigation. - {String} CameraId - (Multiple items possible) Id of the camera part of this investigation (Guid) - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default depends on the value in connect command. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
createPlaybackController(parameters, successCallback, errorCallback) → {ConnectionRequest}
Create playback controller
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {String} SeekType - (optional) Makes seek of specific type: DbStart, DbEnd, PrevSeq, NextSeq, PrevFrame, NextFrame, Time, TimeOrBefore, TimeOrAfter, TimeAfter, TimeBefore. - {Number} Time - (optional) Time in miliseconds - {Number} InvestigationId - (optional) The id of the investigation |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
createVideoPushConnection(successCallback, errorCallback, skipUserMedia) → {ConnectionRequest}
Establishes a connection to an available web camera and requests a video push stream for that camera with requestPushStream.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and a VideoPushConnection object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
skipUserMedia |
Boolean | do not restrict usage to user media, but allow alternative ways for streaming. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
deleteBookmark(id, successCallback, errorCallback) → {ConnectionRequest}
Delete a bookmark by given ID (GUID)
Parameters:
Name | Type | Description |
---|---|---|
id |
String | Id of a bookmark (GUID) |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
deleteInvestigation(investigationId, successCallback, errorCallback) → {ConnectionRequest}
Deletes investigation.
Parameters:
Name | Type | Description |
---|---|---|
investigationId |
Number | Id of the investigation. Tricky values:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX - Single (concrete) investigation. 00000000-0000-0000-0000-0000000000 - All investigation (My) C6B4940C-A1E9-4BBF-9CFC-6E9CBF53FFE1 - All investigations (All users) |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
deleteInvestigationExport(investigationId, exportType, successCallback, errorCallback) → {ConnectionRequest}
Deletes an investigation export on the server.
Parameters:
Name | Type | Description |
---|---|---|
investigationId |
String | Guid. Id of the investigation for which an export will be created. |
exportType |
String | Type of the export to be triggered. Possible values: DB, AVI, MKV (the same as for triggering normal exports) |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
destroy()
Executes to clean up all of the audio parameters.
destroy()
Class destructor
destroy()
This method is the actual fallback. It notify the parent class that we are doing a fallback
and reset it state.
destroy()
Class destructor.
destroy()
Destroys the connection
destroy()
Class destructor.
destroy()
Class destructor
disconnect()
Sends a Disconnect connection command and logs out the current user.
generateURL(location)
Generate WebSocket URL used to open a server socket communication
Parameters:
Name | Type | Description |
---|---|---|
location |
string |
getAlarm(alarmId, successCallback, errorCallback) → {ConnectionRequest}
Gets a single alarm.
Parameters:
Name | Type | Description |
---|---|---|
alarmId |
String | GUID of the alarm to be retrieved |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getAlarmDataSettings(successCallback, errorCallback) → {ConnectionRequest}
Gets settings for alarms (Priority, State).
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getAlarmList(parameters, successCallback, errorCallback) → {ConnectionRequest}
Gets a list of alarms
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {String} MyAlarms - YES/NO - flag whether to send only my Alarms - {Number} Timestamp - Target time - {Number} Count - Max alarms count to return - {String} Priority - Priority of the alarm (id of the priority type) - {String} State - State of the alarm (id of the state type) |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getAlarmUsers(alarmId, successCallback, errorCallback) → {ConnectionRequest}
Gets list of users for a specified alarm. The alarm can be assigned to any one of these users.
Parameters:
Name | Type | Description |
---|---|---|
alarmId |
String | GUID of the alarm for which users will be retrieved |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getAllCameras(successCallback, errorCallback) → {ConnectionRequest}
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and a camera object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getAllExports(successCallback, errorCallback) → {ConnectionRequest}
Gets all exports.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getAllInvestigations(successCallback, errorCallback) → {ConnectionRequest}
Get all investigations from server
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getAllViews(successCallback, errorCallback) → {ConnectionRequest}
Sends a GetAllViewsAndCameras connection command to get the full tree of views starting from the root.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and a views object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getBookmarks(parameters, successCallback, errorCallback) → {ConnectionRequest}
Gets a list of bookmarks
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {String} MyBookmarks - YES/NO - flag whether to send only my Bookmarks - {Number} Count - Maximum number of bookmarks to be returned in the result. If you want to retrieve a specific bookmark you should not specify the count, but provide the BookmarkId only. - {String} StartTime - (Optional) Start time of the search interval. It specifies from where the search of bookmark will begin. If not specified current time will be considered as a start time. - {String} EndTime - (Optional) End time of the search interval. If the EndTime is set before the StartTime than the bookmarks will be returned in reversed order again starting to search from StartTime to EndTime. - {String} MyBookmarks - (Optional)YES/NO - flag whether to send only my Bookmarks - {String} Keyword - (Optional)Search string to appear in either of the fields 'Reference', 'Header', 'Description' - {String} SearchCameraIds - (Optional) Included cameras GUIDs in a comma separated string |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getCameraCapabilities(cameraId, successCallback, errorCallback) → {ConnectionRequest}
Gets the camera capabilities - export, live, playback, ptz, presets.
Parameters:
Name | Type | Description |
---|---|---|
cameraId |
String | GUID of the camera |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getDBStartTime(cameraId, successCallback, errorCallback) → {ConnectionRequest}
Gets the start time of the recordings for a particular camera.
Parameters:
Name | Type | Description |
---|---|---|
cameraId |
String | ID of the camera, which recordings database time is requested |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getData(dataView,)
Called to get the video data from the binary
Parameters:
Name | Type | Description |
---|---|---|
dataView, |
binary, video data |
getExport(id, successCallback, errorCallback) → {ConnectionRequest}
Gets an export by id.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | ID of the export to retrieve (GUID). |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getGUID()
Retrieving string of guid from its binary representation
getInvestigation(id, successCallback, errorCallback) → {ConnectionRequest}
Gets a specific investigation by its id
Parameters:
Name | Type | Description |
---|---|---|
id |
String | the investigation id |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getMediaStream()
Retrieves a media stream
getNextSequence(cameraId, timestamp, successCallback, errorCallback) → {ConnectionRequest}
Gets the next sequence by given time for the given cameraId.
Parameters:
Name | Type | Description |
---|---|---|
cameraId |
String | ID of the camera (GUID) for which Sequences are retrieved. |
timestamp |
Number | milliseconds in UTC, a sequence after this moment will be returned |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getOutputsAndEvents(successCallback, errorCallback) → {ConnectionRequest}
Sends a GetOutputsAndEvents command to the server, gets configuration entry from the server.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getPrevSequence(cameraId, timestamp, successCallback, errorCallback) → {ConnectionRequest}
Gets the previous sequence by given time.
Parameters:
Name | Type | Description |
---|---|---|
cameraId |
String | ID of the camera (GUID) for which Sequences are retrieved. |
timestamp |
Number | milliseconds in UTC, a sequence before this moment will be returned |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getPtzPresets(cameraId, successCallback, errorCallback) → {ConnectionRequest}
Sends a GetPtzPresets command to the server.
Parameters:
Name | Type | Description |
---|---|---|
cameraId |
GUID | the current camera related to the presets this request will return |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getResamplingFactor() → {Number}
Gets the resampling factor
Returns:
- the resampling factor
- Type
- Number
getSequencesForView(ItemId, startTime:, endTime:, minTimeBetweenSequences:, successCallback:, failCallback:, SeqType, ItemKind) → {ConnectionRequest}
Gets all the sequences the sequences for the view.
Parameters:
Name | Type | Description |
---|---|---|
ItemId |
Array | (Multiple items possible) ID of the item (camera) (GUID) for which are retrieved Sequences. |
startTime: |
Number | milliseconds in UTC, the start time of the interval |
endTime: |
Number | milliseconds in UTC, the end time of the interval |
minTimeBetweenSequences: |
Number | (optional) If sequences have time gap lower than this value (in seconds), they will be merged in one big sequence. Default value is 0 |
successCallback: |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
failCallback: |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
SeqType |
SeqType | Type of the sequences requests � enumeration (Motion, Recording, RecordingWithTrigger). |
ItemKind |
String | The kind of item for which the sequences are being requested (Camera, Microphone). |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getSequencesInInterval(cameraId, startTime, endTime, investigationId, successCallback, errorCallback) → {ConnectionRequest}
Gets all the sequences in a given interval of time.
Parameters:
Name | Type | Description |
---|---|---|
cameraId |
String | ID of the camera (GUID) for which Sequences are retrieved. |
startTime |
Number | milliseconds in UTC, the start time of the interval |
endTime |
Number | milliseconds in UTC, the end time of the interval |
investigationId |
String | The id of the investigation (export) to be used for extracting the sequences. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getServerStatus(successCallback, errorCallback) → {ConnectionRequest}
Gets server statistic (CPU load, network trafic etc.)
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getThumbnail(cameraId, successCallback, errorCallback) → {ConnectionRequest}
Sends a GetThumbnail command to the server in order to obtain an image representation for a given camera.
Parameters:
Name | Type | Description |
---|---|---|
cameraId |
String | the unique GUID of the camera |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getThumbnailByTime(params, successCallback, errorCallback) → {ConnectionRequest}
Gets thumbnail by the given camera id and time.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Object containing the following properties:
- {String} cameraId - Id of the requested camera thumbnail - {Number} time - Miliseconds since start of UNIX epoch, in UTC. - {Number} width - Max width of the requested camera thumbnail - {Number} height - Max height of the requested camera thumbnail |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getUserExports(successCallback, errorCallback) → {ConnectionRequest}
Gets the exports for the currently logged user.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getUserInvestigations(successCallback, errorCallback) → {ConnectionRequest}
Get user investigations from server
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
getViews(viewId, successCallback, errorCallback) → {ConnectionRequest}
Sends a GetViews connection command to get the sub-views of any view using its id.
Parameters:
Name | Type | Description |
---|---|---|
viewId |
String | view id |
successCallback |
function | function that is called when the command execution was successful and a view object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
initializeConnection(storageopt)
Initializes the Connection singleton. Must be called before using any of the other methods.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
storage |
Object |
<optional> |
(optional) the storage used to store server features in, and to initialize them from (for example XPMobileSDK.localStorage, XPMobileSDK.sessionStorage, or any object implementing their methods). The server features are retrieved on login. The idea is to keep the connection state if you want to connectWithId, but it may be cleared on some cases (browser refresh for example). |
isDataTypeSupported(fragment)
This checks if the fragment receveid for DirectStreaming is supported or not.
In case that it is not supported it will trigger an fallback.
Parameters:
Name | Type | Description |
---|---|---|
fragment |
object |
isDirectStreaminigSupported(streamType)
Checks if the stream is DirectStreaming or not. It received the data from the RequestStream repond
Parameters:
Name | Type | Description |
---|---|---|
streamType |
string |
isOpen()
Checks if the connection is open
Returns:
Boolean - Returns the stream object if the connection is opened
load(queue)
Loads all scripts from a queue
Parameters:
Name | Type | Description |
---|---|---|
queue |
Array | Array containing all script for loading |
loadComplete()
Called when all scripts are loaded
login(username, password, loginType, parameters) → {ConnectionRequest}
Sends a LogIn connection command to log a user with valid usernam and password.
The changes of the login status are propagated to all listeners through the ConnectionObserver interface methods.
Listeners implementing the ConnectionObserver interface methods are added with the addObserver method.
Parameters:
Name | Type | Description |
---|---|---|
username |
String | username |
password |
String | password |
loginType |
String | loginType |
parameters |
Object | other parameters. May contain:
- {Number} NumChallenges - Number of challenges the MoS should return. Up to 100 can be requested at once. - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default is Yes. - {String} SupportsResampling - (optional) [Yes/No] When present and equal to "Yes", indicates that the client can handle downsized images. This instructs Quality of Service to reduce the size of the sent images as additional measure in cases of low bandwidth. - {String} SupportsExtendedResamplingFactor - (optional) [Yes/No] When present and equal to "Yes", indicates that client supports working with decimal resampling factor. Influence on the type of ResamplingTag received in Header Extension Flags of Video frame |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
login(idpClientId, identityToken, accessToken, RefreshToken, loginType, parameters) → {ConnectionRequest}
Sends a LogIn connection command to log a user with valid idpClientId, identityToken, accessToken and RefreshToken.
The changes of the login status are propagated to all listeners through the ConnectionObserver interface methods.
Listeners implementing the ConnectionObserver interface methods are added with the addObserver method.
Parameters:
Name | Type | Description |
---|---|---|
idpClientId |
String | idpClientId |
identityToken |
String | identityToken |
accessToken |
String | accessToken |
RefreshToken |
String | RefreshToken |
loginType |
String | loginType |
parameters |
Object | other parameters. May contain:
- {Number} NumChallenges - Number of challenges the MoS should return. Up to 100 can be requested at once. - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default is Yes. - {String} SupportsResampling - (optional) [Yes/No] When present and equal to "Yes", indicates that the client can handle downsized images. This instructs Quality of Service to reduce the size of the sent images as additional measure in cases of low bandwidth. - {String} SupportsExtendedResamplingFactor - (optional) [Yes/No] When present and equal to "Yes", indicates that client supports working with decimal resampling factor. Influence on the type of ResamplingTag received in Header Extension Flags of Video frame |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
motionDetection(videoConnection, options) → {ConnectionRequest}
Sends a ChangeStream command to the server.
Changes the motion detection settings of the stream that the given videoConnection represents.
Parameters:
Name | Type | Description |
---|---|---|
videoConnection |
VideoConnection | existing VideoConnection object representing a camera stream |
options |
Object | contains any or all of the motion, sensitivity, grid and cpu parameters. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
nextCarouselCamera(videoId) → {ConnectionRequest}
Request the next camera for the given carousel.
Parameters:
Name | Type | Description |
---|---|---|
videoId |
String | ID of the carousel stream |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
onCanPlay()
This method will executed when the video can be played and will reset the timeout,
which monitor the netowrk
onClose(event)
Callback which is fired when socket communication with mobile server is closed
Parameters:
Name | Type | Description |
---|---|---|
event |
event |
onMessage(event)
Callback that is fired when a new video frames is received from mobile server
Parameters:
Name | Type | Description |
---|---|---|
event |
event | Stores the video data |
onOpen()
Callback that is fired when the WebSocket is opened.
onStateChange(state)
Set the state of the connection
Parameters:
Name | Type | Description |
---|---|---|
state |
string |
onVideoWaiting(event)
This method monitor video player and triger a timeout that
will be executed if there is no video for some time:NO_VIDEO_TIMEOUT
Parameters:
Name | Type | Description |
---|---|---|
event |
object |
open()
Opens socket communication to the mobile server in order to retreive video data
open()
Opens the connection to start receiving frames.
open()
Opens the connection to start receiving frames.
open()
Opens the video push connection
parseCarouselInfo()
Get carousel information
parseHeader()
Parse video frame headers
parseLiveInformation()
Get live events information
parseMotionInformation()
Get motion amount information
parsePlaybackInfo()
Get playback info
parsePlaybackInformation()
Get playback events information
parseSizeInformation()
Get all information from header related with frame size
parseStreamInfo()
Get stream information
pauseCarousel(videoId) → {ConnectionRequest}
Pauses a carousel.
Parameters:
Name | Type | Description |
---|---|---|
videoId |
String | ID of the carousel stream |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
playbackGoTo(videoConnection, millisecondsSinceUnixEpoch, seekType, successCallback, errorCallback) → {ConnectionRequest}
Sends a ChangeStream command to the server. Goes to the closest possible match of specific time.
Parameters:
Name | Type | Description |
---|---|---|
videoConnection |
VideoConnection | existing VideoConnection object representing a camera stream |
millisecondsSinceUnixEpoch |
Number | Time of playback speed (in milliseconds since Unix epoch). Valid if SeekType == Time |
seekType |
String | optional, 'Time' (default), 'TimeOrBefore', 'TimeOrAfter' |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
playbackSeek(videoConnection, seekType) → {ConnectionRequest}
Sends a ChangeStream command to the server.
Seeks to either of: 'DbStart', 'DbEnd', 'PrevSeq', 'NextSeq', 'PrevFrame' or 'NextFrame'.
Parameters:
Name | Type | Description |
---|---|---|
videoConnection |
VideoConnection | existing VideoConnection object representing a camera stream |
seekType |
String | 'DbStart', 'DbEnd', 'PrevSeq', 'NextSeq', 'PrevFrame' or 'NextFrame' |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
playbackSpeed(videoConnection, speed) → {ConnectionRequest}
Sends a ChangeStream command to the server.
Controls playback speed as a float. Negative number means backwards. 1.0 means normal speed.
Parameters:
Name | Type | Description |
---|---|---|
videoConnection |
VideoConnection | existing VideoConnection object representing a camera stream |
speed |
Number | Speed of the playback (floating point). Sign determines the direction |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
prevCarouselCamera(videoId) → {ConnectionRequest}
Request the prev camera for the given carousel.
Parameters:
Name | Type | Description |
---|---|---|
videoId |
String | ID of the carousel stream |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
ptzMove(videoConnection, direction) → {ConnectionRequest}
Sends a ControlPTZ command to the server. Controls PTZMove.
Directions are: 'Up', 'Down', 'Left', 'Right', 'UpLeft', 'UpRight', 'DownLeft',
'DownRight', 'ZoomIn', 'ZoomOut', 'Home'.
The camera needs to support PTZ, otherwise nothing will happen.
Parameters:
Name | Type | Description |
---|---|---|
videoConnection |
VideoConnection | existing VideoConnection object representing a PTZ camera stream |
direction |
String | 'Up', 'Down', 'Left', 'Right', 'UpLeft', 'UpRight', 'DownLeft', 'DownRight', 'ZoomIn', 'ZoomOut', 'Home' |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
ptzPreset(videoConnection, presetName) → {ConnectionRequest}
Sends a ControlPTZ command to the server. Controls PTZ Preset.
The parameter needs to be a valid preset name, otherwise nothing will happen.
Parameters:
Name | Type | Description |
---|---|---|
videoConnection |
VideoConnection | existing VideoConnection object representing a camera stream |
presetName |
String | the name of the preset to be activated |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
ptzSwipe(parameters, gestureDuration) → {ConnectionRequest}
It is used to change the camera orientation by moving it in the direction of the swipe.
The swipe direction and length are calculated based on the start and end points of the gesture.
The swipe speed is calculated based on the time it took to perform the gesture
from the start point to the end point.
The calculated direction defines the direction of the PTZ movement,
whereas the length and the speed are used to determine the amount of the PTZ movement.
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {String} CameraId - unique GUID of the camera - {Number} GestureXPercent - the percentage of distance between start and finish [-100:100] - {Number} GestureYPercent - the percentage of distance between start and finish [-100:100] |
gestureDuration |
Number | number of milliseconds |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
ptzTapAndHold(parameters, successCallback, errorCallback) → {ConnectionRequest}
It is used to change the camera orientation by moving it in the direction of the tap.
The reference point of the movement is the center of the screen.
The tap and the reference points are used to calculate the direction and the speed of the camera movement.
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {String} CameraId - unique GUID of the camera - {Number} GestureXPercent - the percentage of distance between start and finish [-100:100] - {Number} GestureYPercent - the percentage of distance between start and finish [-100:100] |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
readAndReverseToString(count)
Reads bytes from buffer and converts to hex string
Parameters:
Name | Type | Description |
---|---|---|
count |
number of bytes to read |
Returns:
string - hex representation of the bytes read
readBytes(number)
Read bytes from ArrayBuffer
Parameters:
Name | Type | Description |
---|---|---|
number |
bytesCount Number of bytes to read from ArrayByffer |
readBytesAsCharacters()
Get frame timestamp in milliseconds unix timestamp
readToString(count)
Reads bytes from buffer, reverse bytes in the array and converts to hex string
Parameters:
Name | Type | Description |
---|---|---|
count |
number of bytes to read |
Returns:
string - hex representation of the bytes read
readToStringBase(count)
Base method for reading bytes from buffer, processing them and converts to hex string
Parameters:
Name | Type | Description |
---|---|---|
count |
number of bytes to read |
Returns:
string - hex representation of the bytes read
removeObserver(observer:)
Removes an observer for the video connection.
Parameters:
Name | Type | Description |
---|---|---|
observer: |
any object implementing VideoConnectionObserverInterface that should not receive further notifications |
removeObserver(observer:)
Removes an observer for the video connection.
Parameters:
Name | Type | Description |
---|---|---|
observer: |
any object implementing VideoConnectionObserverInterface that should not receive further notifications |
removeObserver(observer)
Removes an existing observer from the Connection singleton.
Parameters:
Name | Type | Description |
---|---|---|
observer |
Object | an arbitrary object implementing the ConnectionObserverInterface interface |
- See:
-
- ConnectionObserverInterface
removeObserver(observer)
Removes an observer for the video connection.
Parameters:
Name | Type | Description |
---|---|---|
observer |
Object | Any object implementing VideoConnectionObserverInterface that should not receive further notifications |
requestAudioStream(cameraId, options, successCallback, errorCallback) → {ConnectionRequest}
Sends a RequestAudioStream connection command to get the live/playback video stream of a camera as a VideoConnection object from the server.
Parameters:
Name | Type | Description |
---|---|---|
cameraId |
String | unique GUID of the microphone that should be started |
options |
AudioConnectionOptions | optional, optional configuration. May contain:
- {String} signal - Type of the requested signal - Live, Playback. - {int} compressionLevel - {boolean} reuseConnection - if true, the API will reuse existing connections for the same microphone |
successCallback |
function | function that is called when the command execution was successful and a VideoConnection object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
requestAudioStreamIn(itemId, options, successCallback, errorCallback) → {ConnectionRequest}
Sends a RequestAudioStreamIn connection command to get an upstream for audio push to the server.
Parameters:
Name | Type | Description |
---|---|---|
itemId |
String | Id of the item (speaker), which stream is requested (GUID) |
options |
AudioConnectionOptions | optional, optional configuration. May contain:
- {Number} AudioSamplingRate - The audio sampling rate in Hz value - {Number} AudioBitsPerSample - 8/16 - Audio bits per sample - {Number} AudioChannelsNumber - 1/2 - Number of audio channels (mon or stereo) |
successCallback |
function | function that is called when the command execution was successful and a stream parameters object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
requestChallenges(parameters, successCallback, errorCallback) → {ConnectionRequest}
Get new challenges from server
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {Number} NumChallenges - Number of challenges that will be returned as a response. Up to 100 can be requested at once. There is limitation of the total challenges in the queue. If exceeded error code is returned. - {String} Reset - Whether to reset the list of challenges with a fresh one.('Yes', 'No') |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
requestCode(successCallback, errorCallback) → {ConnectionRequest}
Sends a RequestSecondStepAuthenticationPin connection command after successful login with a valid username and password.
This method is used only if the server has called the connectionRequiresCode method of the ConnectionObserver interface.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
requestPushStream(successCallback, errorCallback) → {ConnectionRequest}
Sends a RequestStream connection command to get an upstream for video push to the server.
Parameters:
Name | Type | Description |
---|---|---|
successCallback |
function | function that is called when the command execution was successful and a stream parameters object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
requestStream(cameraId, size, options, successCallback, errorCallback) → {ConnectionRequest}
Sends a RequestStream connection command to get the live/playback video stream of a camera as a VideoConnection object from the server.
Parameters:
Name | Type | Description |
---|---|---|
cameraId |
String | unique GUID of the camera that should be started |
size |
VideoConnectionSize | output stream size |
options |
VideoConnectionOptions | optional, optional configuration. May contain:
- {String} signal - Type of the requested signal - Live, Playback or Upload. - {String} streamType - Shows if this is a transcoded or a direct stream. Possible values - Native and Transcoded. |
successCallback |
function | function that is called when the command execution was successful and a VideoConnection object is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and an error object is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
resetCommunication()
Resets communication
resetFragmentCountTimeout()
This method will executed when the video can be played and will reset the timeout,
which monitor the netowrk
restart()
Restarts the connection.
restart()
Restarts the connection.
resumeCarousel(videoId) → {ConnectionRequest}
Resumes a carousel.
Parameters:
Name | Type | Description |
---|---|---|
videoId |
String | ID of the carousel stream |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
retrieveData()
Retrieve frame binary data
send()
Sends video frame to server
sendCommand(commandName, requestParams, optionsopt, successCallback, errorCallback)
Sends requests to the server. Creates ConnectionRequest instances.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
commandName |
String | the name of the command | |
requestParams |
Object | the parameters of the command | |
options |
Object |
<optional> |
(optional) May contain:
- {Number} timeout - time interval in milliseconds after which the request will be aborted - {Boolean} reuseConnection - flag to reuse connection or not - {String} viewId - the unique GUID of the view that we will work on - {String} cameraId - the unique GUID of the camera that should be started - {Function} successCallback - callback that is provided by the client code of the Network API which will be called during the execution of the callback parameter. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. | |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
start()
Start the socket communication with mobile server
startInvestigationExport(investigationId, exportType, includeAudio, password, successCallback, errorCallback) → {ConnectionRequest}
Triggers new investigation export in the server.
Parameters:
Name | Type | Description |
---|---|---|
investigationId |
String | Guid. Id of the investigation for which an export will be created. |
exportType |
String | Type of the export to be triggered. Possible values: DB, AVI, MKV (the same as for triggering normal exports) |
includeAudio |
String | YES/NO - flag whether to include audio in the investigation export |
password |
String | password used to encrypt exported video |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
toggleAnalytics(enabled)
Toggles the Analytic Data setting
Parameters:
Name | Type | Description |
---|---|---|
enabled |
Boolean | Enable or not analytics |
toggleDiagnosticsOverlay(enabled)
Toggles the Diagnostics overlay setting
Parameters:
Name | Type | Description |
---|---|---|
enabled |
Boolean | Enable or not the overlay |
toggleDirectStreaming(enabled)
Toggles the Direct streaming setting
Parameters:
Name | Type | Description |
---|---|---|
enabled |
Boolean | Enable or not direct streaming |
triggerOutputOrEvent(objectId, triggerType, successCallback, errorCallback) → {ConnectionRequest}
Triggers an output or event.
Parameters:
Name | Type | Description |
---|---|---|
objectId |
String | the Id of the item |
triggerType |
String | 'TriggerOutput' or 'TriggerEvent' |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
uintToHexString(v)
Converts byte to hex string
Parameters:
Name | Type | Description |
---|---|---|
v |
Returns:
updateAlarm(parameters, successCallback, errorCallback) → {ConnectionRequest}
Update alarm details
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {String} Id - Id of the Alarm to update - {String} Comment - Updated comment - {String} AssignedTo - Updated alarm assignee - {String} Priority - Updated priority of the alarm (id of the priority type) - {String} State - Updated state of the alarm (id of the state type) |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
updateInvestigation(parameters, successCallback, errorCallback) → {ConnectionRequest}
Updates/saves new parameters of already created investigation
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {Number} ItemId - Id of the already saved investigation. - {Number} StartTime - Start time of the investigation (milliseconds since Unix epoch) - {Number} EndTime - End Time of the investigation (milliseconds since Unix epoch) - {String} Name - Name of the investigation. - {String} State - (optional) State of the investigation. - {String} CameraId - (Multiple items possible) Id of the camera part of this investigation (Guid) - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default depends on the value in connect command. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
updateInvestigationData(parameters, successCallback, errorCallback) → {ConnectionRequest}
Updates mata-data of the alredy created investigation
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object | Object containing the following properties:
- {Number} ItemId - Id of the already saved investigation. - {String} Name - (optional) Name of the investigation. - {String} State - (optional) State of the investigation. - {String} ProcessingMessage - (optional) [Yes/No] Indicates whether processing messages should be sent from server while processing the request. Default depends on the value in connect command. |
successCallback |
function | function that is called when the command execution was successful and the result is passed as a parameter. |
errorCallback |
function | function that is called when the command execution has failed and the error is passed as a parameter. |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
verifyCode(code) → {ConnectionRequest}
Sends a RequestSecondStepAuthenticationPin connection command after successful login with a valid username and password.
This method is used only if the server has called the connectionRequiresCode method of the ConnectionObserver interface.
Parameters:
Name | Type | Description |
---|---|---|
code |
String | second step authentication pin code |
Returns:
- the ConnectionRequest object
- Type
- ConnectionRequest
videoConnectionChangedState()
Called if the state property of the connection has changed value.
videoConnectionChangedState()
Called if the state property of the connection has changed value.
videoConnectionFailed()
Called when an error has occurred during video streaming or in one of the internal control commands which has
resulted in closing the connection completely.
videoConnectionFailed()
Called when an error has occurred during video streaming or in one of the internal control commands which has
resulted in closing the connection completely.
videoConnectionReceivedFrame(frame)
Called when new frame has arrived over the video connection
Parameters:
Name | Type | Description |
---|---|---|
frame |
ItemHeaderParser |
videoConnectionReceivedFrame(frame)
Called when new frame has arrived over the video connection
Parameters:
Name | Type | Description |
---|---|---|
frame |
ItemHeaderParser | HeaderParser object representing the frame |
videoConnectionRecovered()
Called after the connection is no longer down due to an HTTP error.
videoConnectionStreamingError()
Called when the streaming technology is no longer available.
videoConnectionTemporaryDown(errorCode)
Called when a HTTP error occurred
Parameters:
Name | Type | Description |
---|---|---|
errorCode |
Number | the HTTP error code returned from the server, or -1 if exception was thrown, or -2 if the request was aborted due to a missing response (happens more often on wireless networks) |
videoConnectionTemporaryDown(errorCode)
Called when a HTTP error occurred
Parameters:
Name | Type | Description |
---|---|---|
errorCode |
Number | the HTTP error code returned from the server, or -1 if exception was thrown, or -2 if the request was aborted due to a missing response (happens more often on wireless networks) |