Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: new MediaFile() - fix wrong property name for localURL #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions www/MediaFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var utils = require('cordova/utils'),
* Represents a single file.
*
* name {DOMString} name of the file, without path information
* fullPath {DOMString} the full path of the file, including the name
* localURL {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
Expand All @@ -45,10 +45,20 @@ utils.extend(MediaFile, File);
* @param {Function} errorCB
*/
MediaFile.prototype.getFormatData = function(successCallback, errorCallback) {

//case when MediaFile is manually created, not a result of media-capture
if (typeof this.fullPath === "undefined" && this.localURL !== null) {
this.fullPath = this.localURL;

if (device.platform.toLowerCase() == 'ios' && this.fullPath.indexOf('file://') != -1) {
this.fullPath = this.fullPath.replace('file://', '');
}
}

if (typeof this.fullPath === "undefined" || this.fullPath === null) {
errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
} else {
exec(successCallback, errorCallback, "Capture", "getFormatData", [this.localURL, this.type]);
exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]);
}
};

Expand Down