Update MediaFile.js

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/570b0cd7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/570b0cd7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/570b0cd7

Branch: refs/heads/master
Commit: 570b0cd7ddec41566c34eeb6db87ceb2fba7cb73
Parents: 4779732
Author: mpberk <matthew.p.b...@intel.com>
Authored: Fri Aug 17 11:16:19 2012 -0700
Committer: mpberk <matthew.p.b...@intel.com>
Committed: Fri Aug 17 11:16:19 2012 -0700

----------------------------------------------------------------------
 lib/win8metro/plugin/win8metro/MediaFile.js |   70 +++++++++++-----------
 1 files changed, 34 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/570b0cd7/lib/win8metro/plugin/win8metro/MediaFile.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/MediaFile.js 
b/lib/win8metro/plugin/win8metro/MediaFile.js
index f754105..2522dfe 100755
--- a/lib/win8metro/plugin/win8metro/MediaFile.js
+++ b/lib/win8metro/plugin/win8metro/MediaFile.js
@@ -4,41 +4,39 @@ var CaptureError = require('cordova/plugin/CaptureError');
 module.exports = {
 
     getFormatData: function (successCallback, errorCallback, args) {
-        if (typeof this.fullPath === "undefined" || this.fullPath === null) {
-            errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-        } else {
-            var contentType = this.type;
-            
Windows.Storage.StorageFile.getFileFromPathAsync(this.fullPath).then(function 
(storageFile) {
-                var mediaTypeFlag = 
String(contentType).split("/")[0].toLowerCase();
-                if (mediaTypeFlag === "audio") {
-                    
storageFile.properties.getMusicPropertiesAsync().then(function 
(audioProperties) {
-                        successCallback(new MediaFileData(null, 
audioProperties.bitrate, 0, 0, audioProperties.duration / 1000));
-                    }, function () {
-                        errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-                    })
-                }
-                else if (mediaTypeFlag === "video") {
-                    
storageFile.properties.getVideoPropertiesAsync().then(function 
(videoProperties) {
-                        successCallback(new MediaFileData(null, 
videoProperties.bitrate, videoProperties.height, videoProperties.width, 
videoProperties.duration / 1000));
-                    }, function () {
-                        errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-                    })
-                }
-                else if (mediaTypeFlag === "image") {
-                    
storageFile.properties.getImagePropertiesAsync().then(function 
(imageProperties) {
-                        successCallback(new MediaFileData(null, 0, 
imageProperties.height, imageProperties.width, 0));
-                    }, function () {
-                        errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-                    })
-                }
-                else { errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT)) }
-            }, function () {
-                errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-            }
-            )
-
-        }
-        
+               
Windows.Storage.StorageFile.getFileFromPathAsync(this.fullPath).then(
+                       function (storageFile) {
+                               var mediaTypeFlag = 
String(contentType).split("/")[0].toLowerCase();
+                               if (mediaTypeFlag === "audio") {
+                                       
storageFile.properties.getMusicPropertiesAsync().then(
+                                               function (audioProperties) {
+                                                       successCallback(new 
MediaFileData(null, audioProperties.bitrate, 0, 0, audioProperties.duration / 
1000));
+                                               }, function () {
+                                                       errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+                                               }
+                                       )
+                               } else if (mediaTypeFlag === "video") {
+                                       
storageFile.properties.getVideoPropertiesAsync().then(
+                                               function (videoProperties) {
+                                                       successCallback(new 
MediaFileData(null, videoProperties.bitrate, videoProperties.height, 
videoProperties.width, videoProperties.duration / 1000));
+                                               }, function () {
+                                                       errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+                                               }
+                                       )
+                               } else if (mediaTypeFlag === "image") {
+                                       
storageFile.properties.getImagePropertiesAsync().then(
+                                               function (imageProperties) {
+                                                       successCallback(new 
MediaFileData(null, 0, imageProperties.height, imageProperties.width, 0));
+                                               }, function () {
+                                                       errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+                                               }
+                                       )
+                               } else {
+                                       errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT))
+                               }
+                       }, function () {
+                               errorCallback(new 
CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+                       }
+               )
     }
-
 }
\ No newline at end of file

Reply via email to