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);
}