incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [18/19] js commit: Update MediaFileProxy.js
Date Fri, 17 Aug 2012 18:54:50 GMT
Update MediaFileProxy.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/0b898a53
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/0b898a53
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/0b898a53

Branch: refs/heads/master
Commit: 0b898a530a6d494d6c71c8b52facedea51c74ceb
Parents: fbafb34
Author: wangmingfeng <mingfengwang01@gmail.com>
Authored: Thu Aug 16 09:14:52 2012 +0800
Committer: wangmingfeng <mingfengwang01@gmail.com>
Committed: Thu Aug 16 09:14:52 2012 +0800

----------------------------------------------------------------------
 lib/win8metro/plugin/win8metro/MediaFileProxy.js |   49 ++---------------
 1 files changed, 6 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/0b898a53/lib/win8metro/plugin/win8metro/MediaFileProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/MediaFileProxy.js b/lib/win8metro/plugin/win8metro/MediaFileProxy.js
index e9c4e72..de34af8 100755
--- a/lib/win8metro/plugin/win8metro/MediaFileProxy.js
+++ b/lib/win8metro/plugin/win8metro/MediaFileProxy.js
@@ -1,20 +1,7 @@
 var utils = require('cordova/utils'),
     File = require('cordova/plugin/File'),
     CaptureError = require('cordova/plugin/CaptureError');
-/**
- * Represents a single file.
- *
- * name {DOMString} name of the file, without path information
- * fullPath {DOMString} the full path of the file, including the name
- * type {DOMString} mime type
- * lastModifiedDate {Date} last modified date
- * size {Number} size of the file in bytes
- */
-var MediaFile = function (name, fullPath, type, lastModifiedDate, size) {
-    MediaFile.__super__.constructor.apply(this, arguments);
-};
 
-utils.extend(MediaFile, File);
 
 /**
  * Request capture format data for a specific file and type
@@ -22,12 +9,9 @@ utils.extend(MediaFile, File);
  * @param {Function} successCB
  * @param {Function} errorCB
  */
-MediaFile.prototype.getFormatData = function (successCallback, errorCallback) {
-    var contentType = this.type;
-    if (typeof this.fullPath === "undefined" || this.fullPath === null) {
-        errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-    } else {
-        Windows.Storage.StorageFile.getFileFromPathAsync(this.fullPath).then(function (storageFile)
{
+MediaFile.prototype.getFormatData = function (successCallback, errorCallback, args) {
+    var contentType = args[1];
+    Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(function (storageFile)
{
             var mediaTypeFlag = String(contentType).split("/")[0].toLowerCase();
             if (mediaTypeFlag === "audio") {
                 storageFile.properties.getMusicPropertiesAsync().then(function (audioProperties)
{
@@ -53,30 +37,9 @@ MediaFile.prototype.getFormatData = function (successCallback, errorCallback)
{
             else { errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT))
}
         }, function () {
             errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-        })
-    }
-};
+        }
+    )
+ };
 
-// TODO: can we axe this?
-/**
- * Casts a PluginResult message property  (array of objects) to an array of MediaFile objects
- * (used in Objective-C and Android)
- *
- * @param {PluginResult} pluginResult
- */
-MediaFile.cast = function (pluginResult) {
-    var mediaFiles = [];
-    for (var i = 0; i < pluginResult.message.length; i++) {
-        var mediaFile = new MediaFile();
-        mediaFile.name = pluginResult.message[i].name;
-        mediaFile.fullPath = pluginResult.message[i].fullPath;
-        mediaFile.type = pluginResult.message[i].type;
-        mediaFile.lastModifiedDate = pluginResult.message[i].lastModifiedDate;
-        mediaFile.size = pluginResult.message[i].size;
-        mediaFiles.push(mediaFile);
-    }
-    pluginResult.message = mediaFiles;
-    return pluginResult;
-};
 
 module.exports = MediaFile;
\ No newline at end of file


Mime
View raw message