How to get recorded video in a web app?I have an AngularJS app and I need to bring a recording from a camera. I am using MIP SDK Mobile. I'm not sure what method I should use for what I want to do or how I must call him.

How to get recorded video from a camera?

I have an AngularJS application and I need to bring some recording from a camera. The recording must correspond to a date and time that I indicate. I am using MIP SDK Mobile, and I was reviewing the Web examples that it brings (for example the videoSample). I’m not sure what the method is for what I want to do or how I must call him. Does anyone have any ideas? Where could I find an example?

Hi Aimee,

I’m not completely sure I fully understand your workflow (what exactly you want to achieve), but I’ll try to give you some directions.

There are two approaches of “The recording must correspond to a date and time that I indicate” depending on what exactly you have in mind and how final UX will look like .

In both cases you have to first do “connect” and “login” to the MoS.

  • You could create a playback stream from the MoS and push periodic “seek” commands in order to sync the the time you shows in the UI with the image from the RS.

I suppose in this case you will have those “times of interests” in some other way / communication channel.

For this approach you could really “steal” much code from the “videoSample”.

In general you have to call “requestStream” for the playback (in order to create playback stream) and after that you could call “playbackGoTo” (in order to perform seek operation).

  • You could use “getThumbnailByTime” command in order to show image from the particular camera for given time (if any).

In that case in the response of the command you will receive base64 encoded image.

Notes:

All the commands are called trough the “XPMobileSDK”.

You can look in the “XPMobileSDK.js” for the help with commands.

For example:

/**

 \* Sends a ChangeStream command to the server. Goes to the closest possible match of specific time.

 \*

 \* @method playbackGoTo

 \* @param {VideoConnection} videoConnection - existing VideoConnection object representing a camera stream

 \* @param {Number} millisecondsSinceUnixEpoch - Time of playback speed (in milliseconds since Unix epoch). Valid if SeekType == Time

 \* @param {String} seekType - optional, 'Time' (default), 'TimeOrBefore', 'TimeOrAfter'

 \* @param {Function} successCallback - function that is called when the command execution was successful and the result is passed as a parameter.

 \* @param {Function} errorCallback - function that is called when the command execution has failed and the error is passed as a parameter.

 \*

 \* @return {ConnectionRequest} - the ConnectionRequest object

 \*/

function    (videoConnection, millisecondsSinceUnixEpoch, seekType, successCallback, errorCallback) {

 return XPMobileSDK.library.Connection.playbackGoTo(videoConnection, millisecondsSinceUnixEpoch, seekType, successCallback, errorCallback);

}

and

/**

 \* Gets thumbnail by the given camera id and time.

 \*

* @method getThumbnailByTime

* @param {Object} params - 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

*

 \* @param {Function} successCallback - function that is called when the command execution was successful and the result is passed as a parameter.

 \* @param {Function} errorCallback - function that is called when the command execution has failed and the error is passed as a parameter.

 \*

 \* @return {ConnectionRequest} - the ConnectionRequest object

 \*/

function getThumbnailByTime(params, successCallback, errorCallback) {

 return XPMobileSDK.library.Connection.getThumbnailByTime(params, successCallback, errorCallback);

}

Thank you very much for your reply. I used the requestStream and playbackGoTo methods as indicated and I achieved get a video recording. I still have to accommodate certain details, but for the moment everything is fine. I really appreciate your valuable and timely response, it means a lot to me.