我使用Cordova Capture插件在Android应用程序中录制视频。我如何开始和完成录音的时间戳(最好使用毫秒)?
查看Cordova Capture的示例,
尝试添加调用捕获时获取时间戳的代码,并在capturesuccess回调中?
// 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});
}
当然,您应该以正确的范围定义它们,以便可以在其他地方使用它们。