Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var proxy = new MediaCaptureProxy();
proxy.captureVideo(function (videoFile) {
videoFile.getBasicPropertiesAsync().done(function (basicProperties) {
var result = new MediaFile(videoFile.name, 'ms-appdata:///local/' + videoFile.name, videoFile.contentType, basicProperties.dateModified, basicProperties.size);
result.fullPath = videoFile.path;
successCallback([result]);
}, function (err) {
fail(CaptureError.CAPTURE_INTERNAL_ERR, err);
});
}, fail);
} else {
var videoOptions = new CaptureVideoOptions();
if (options.duration && options.duration > 0) {
videoOptions.duration = options.duration;
}
if (options.limit > 1) {
videoOptions.limit = options.limit;
}
var cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
cameraCaptureUI.videoSettings.allowTrimming = true;
cameraCaptureUI.videoSettings.format = Windows.Media.Capture.CameraCaptureUIVideoFormat.mp4;
cameraCaptureUI.videoSettings.maxDurationInSeconds = videoOptions.duration;
cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.video).then(function (file) {
if (file) {
file.moveAsync(Windows.Storage.ApplicationData.current.localFolder, 'cameraCaptureVideo.mp4', Windows.Storage.NameCollisionOption.generateUniqueName).then(function () {
file.getBasicPropertiesAsync().then(function (basicProperties) {
var result = new MediaFile(file.name, 'ms-appdata:///local/' + file.name, file.contentType, basicProperties.dateModified, basicProperties.size);
result.fullPath = file.path;