Fixed bugs in CameraProxy, CaptureProxy, FileTransferProxy
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/3288c676 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/3288c676 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/3288c676 Branch: refs/heads/master Commit: 3288c6761a136a8cc6d9308186d8c22fc792886c Parents: 743e3d2 Author: mpberk <matthew.p.b...@intel.com> Authored: Thu Aug 30 14:06:32 2012 -0700 Committer: mpberk <matthew.p.b...@intel.com> Committed: Thu Aug 30 14:06:32 2012 -0700 ---------------------------------------------------------------------- lib/windows8/plugin/windows8/CameraProxy.js | 3 + lib/windows8/plugin/windows8/CaptureProxy.js | 42 ++++++++-------- lib/windows8/plugin/windows8/FileTransferProxy.js | 2 +- 3 files changed, 25 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/3288c676/lib/windows8/plugin/windows8/CameraProxy.js ---------------------------------------------------------------------- diff --git a/lib/windows8/plugin/windows8/CameraProxy.js b/lib/windows8/plugin/windows8/CameraProxy.js index 2e62ed9..5e434f0 100644 --- a/lib/windows8/plugin/windows8/CameraProxy.js +++ b/lib/windows8/plugin/windows8/CameraProxy.js @@ -166,6 +166,9 @@ module.exports = { } else { fileOpenPicker.fileTypeFilter.replaceAll(["*"]); } + var fail = function (fileError) { + errorCallback("FileError, code:" + fileError.code); + }; fileOpenPicker.pickSingleFileAsync().then(function (file) { if (file) { if (destinationType == Camera.DestinationType.FILE_URI) { http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/3288c676/lib/windows8/plugin/windows8/CaptureProxy.js ---------------------------------------------------------------------- diff --git a/lib/windows8/plugin/windows8/CaptureProxy.js b/lib/windows8/plugin/windows8/CaptureProxy.js index e768b37..82e3706 100644 --- a/lib/windows8/plugin/windows8/CaptureProxy.js +++ b/lib/windows8/plugin/windows8/CaptureProxy.js @@ -1,4 +1,4 @@ -var MediaFile = require('cordova/plugin/MediaFile'); +var MediaFile = require('cordova/plugin/MediaFile'); var CaptureError = require('cordova/plugin/CaptureError'); var CaptureAudioOptions = require('cordova/plugin/CaptureAudioOptions'); var CaptureImageOptions = require('cordova/plugin/CaptureImageOptions'); @@ -6,12 +6,12 @@ var CaptureVideoOptions = require('cordova/plugin/CaptureVideoOptions'); var MediaFileData = require('cordova/plugin/MediaFileData'); module.exports = { - + // No UI support. The duration of the audio recording. cameraCaptureAudioDuration: null, - captureAudio:function(successCallback, errorCallback, options) { - var options = options[0]; + captureAudio:function(successCallback, errorCallback, args) { + var options = args[0]; var audioOptions = new CaptureAudioOptions(); if (options.duration && options.duration > 0) { audioOptions.duration = options.duration; @@ -25,7 +25,7 @@ module.exports = { mediaCaputreSettings = null; mediaCaputreSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings(); mediaCaputreSettings.streamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.audio; - } + }; initCaptureSettings(); var mediaCapture = new Windows.Media.Capture.MediaCapture(); mediaCapture.initializeAsync(mediaCaputreSettings).done(function () { @@ -39,18 +39,18 @@ module.exports = { successCallback(results); }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); - }) - }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }) - } + }); + }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }); + }; mediaCapture.startRecordToStorageFileAsync(mediaEncodingProfile, storageFile).then(function () { setTimeout(stopRecord, cameraCaptureAudioDuration * 1000); - }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }) - }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }) - }) + }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }); + }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }); + }); }, - captureImage:function (successCallback, errorCallback, options) { - var options = options[0]; + captureImage:function (successCallback, errorCallback, args) { + var options = args[0]; var imageOptions = new CaptureImageOptions(); var cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI(); cameraCaptureUI.photoSettings.allowCropping = true; @@ -64,15 +64,15 @@ module.exports = { successCallback(results); }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); - }) + }); }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }); - }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }) + }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }); }, - captureVideo:function (successCallback, errorCallback, options) { - var options = options[0]; + captureVideo:function (successCallback, errorCallback, args) { + var options = args[0]; var videoOptions = new CaptureVideoOptions(); if (options.duration && options.duration > 0) { videoOptions.duration = options.duration; @@ -92,11 +92,11 @@ module.exports = { successCallback(results); }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); - }) + }); }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }); - }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }) - + }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); }); + } -} +}; http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/3288c676/lib/windows8/plugin/windows8/FileTransferProxy.js ---------------------------------------------------------------------- diff --git a/lib/windows8/plugin/windows8/FileTransferProxy.js b/lib/windows8/plugin/windows8/FileTransferProxy.js index 8556112..1f77a33 100644 --- a/lib/windows8/plugin/windows8/FileTransferProxy.js +++ b/lib/windows8/plugin/windows8/FileTransferProxy.js @@ -3,7 +3,7 @@ var FileUploadResult = require('cordova/plugin/FileUploadResult'); module.exports = { - upload:function(win, error, options) { + upload:function(successCallback, error, options) { var filePath = options[0]; var server = options[1];