0

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)?

pmichna
  • 4,800
  • 13
  • 53
  • 90

1 Answers1

1

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.

Community
  • 1
  • 1
yuan3y
  • 305
  • 1
  • 8