我使用 Cordova Capture 插件在 Android 应用程序中录制视频。如何获取录制开始和结束的时间戳(最好以毫秒为单位)?
问问题
434 次
1 回答
1
查看Cordova Capture提供的示例,
尝试在调用捕获和捕获成功回调时添加用于获取时间戳的代码?
// 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});
}
当然,您应该在正确的范围内定义它们,以便您可以在其他地方使用它们。
于 2015-05-06T09:51:58.500 回答