Reputation: 4888
I use the Cordova Capture plugin to record videos in an Android application. How can I get timestamps of the recording was started and finished (preferably with milliseconds)?
Upvotes: 0
Views: 457
Reputation: 305
Looking at the example prvoided at Cordova Capture,
Try adding in codes for getting timestamps when capture is called and at captureSuccess callback?
// Called when capture operation is finished
//
function captureSuccess(mediaFiles) {
var timeFinished = new Date().getTime();
var i, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
uploadFile(mediaFiles[i]);
}
}
//...(omitted)
// A button will call this function
//
function captureVideo() {
// Launch device video recording application,
// allowing user to capture up to 2 video clips
var timeStarted = new Date().getTime();
navigator.device.capture.captureVideo(captureSuccess, captureError, {limit: 2});
}
Of course, you should define them at the correct scope so that you can use them elsewhere.
Upvotes: 1