cordova-plugin-camera
Advanced tools
Comparing version 0.2.5 to 0.2.6
{ | ||
"name": "cordova-plugin-camera", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "Cordova Camera Plugin", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -1,5 +0,22 @@ | ||
cordova-plugin-camera | ||
========================== | ||
To install this plugin, follow the [Command-line Interface Guide](http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface). | ||
<!--- | ||
license: Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
If you are not using the Cordova Command-line Interface, follow [Using Plugman to Manage Plugins](http://cordova.apache.org/docs/en/edge/plugin_ref_plugman.md.html). | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
# org.apache.cordova.camera | ||
Plugin documentation: [doc/index.md](doc/index.md) |
@@ -58,1 +58,7 @@ <!-- | ||
* Added amazon-fireos platform. | ||
### 0.2.6 (Jan 02, 2014) | ||
* CB-5658 Add doc/index.md for Camera plugin | ||
* CB-2442 CB-2419 Use Windows.Storage.ApplicationData.current.localFolder, instead of writing to app package. | ||
* [BlackBerry10] Adding platform level permissions | ||
* CB-5599 Android: Catch and ignore OutOfMemoryError in getRotatedBitmap() |
@@ -25,2 +25,3 @@ /* | ||
var cordova = require('cordova'), | ||
@@ -94,12 +95,19 @@ Camera = require('./Camera'), | ||
var _stream = _blob.msDetachStream(); | ||
Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) { | ||
storageFolder.createFileAsync(tempPhotoFileName, Windows.Storage.CreationCollisionOption.generateUniqueName).done(function (file) { | ||
file.openAsync(Windows.Storage.FileAccessMode.readWrite).done(function (fileStream) { | ||
Windows.Storage.Streams.RandomAccessStream.copyAndCloseAsync(_stream, fileStream).done(function () { | ||
var _imageUrl = URL.createObjectURL(file); | ||
successCallback(_imageUrl); | ||
}, function () { errorCallback("Resize picture error."); }); | ||
}, function () { errorCallback("Resize picture error."); }); | ||
}, function () { errorCallback("Resize picture error."); }); | ||
var storageFolder = Windows.Storage.ApplicationData.current.localFolder; | ||
storageFolder.createFileAsync(tempPhotoFileName, Windows.Storage.CreationCollisionOption.generateUniqueName).done(function (file) { | ||
file.openAsync(Windows.Storage.FileAccessMode.readWrite).done(function (fileStream) { | ||
Windows.Storage.Streams.RandomAccessStream.copyAndCloseAsync(_stream, fileStream).done(function () { | ||
var _imageUrl = URL.createObjectURL(file); | ||
successCallback(_imageUrl); | ||
}, function () { | ||
errorCallback("Resize picture error."); | ||
}); | ||
}, function () { | ||
errorCallback("Resize picture error."); | ||
}); | ||
}, function () { | ||
errorCallback("Resize picture error."); | ||
}); | ||
}; | ||
@@ -117,10 +125,9 @@ }; | ||
Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) { | ||
file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
success(new FileEntry(storageFile.name, storageFile.path)); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
var storageFolder = Windows.Storage.ApplicationData.current.localFolder; | ||
file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
success(new FileEntry(storageFile.name, storageFile.path)); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
@@ -171,12 +178,12 @@ | ||
Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) { | ||
file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
success(new FileEntry(storageFile.name, storageFile.path)); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
var storageFolder = Windows.Storage.ApplicationData.current.localFolder; | ||
file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
success(new FileEntry(storageFile.name, "ms-appdata:///local/" + storageFile.name)); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
}; | ||
@@ -189,5 +196,7 @@ | ||
fileOpenPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]); | ||
} else if (mediaType == Camera.MediaType.VIDEO) { | ||
} | ||
else if (mediaType == Camera.MediaType.VIDEO) { | ||
fileOpenPicker.fileTypeFilter.replaceAll([".avi", ".flv", ".asx", ".asf", ".mov", ".mp4", ".mpg", ".rm", ".srt", ".swf", ".wmv", ".vob"]); | ||
} else { | ||
} | ||
else { | ||
fileOpenPicker.fileTypeFilter.replaceAll(["*"]); | ||
@@ -201,12 +210,12 @@ } | ||
resizeImage(file); | ||
} else { | ||
Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) { | ||
file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
var _imageUrl = URL.createObjectURL(storageFile); | ||
successCallback(_imageUrl); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
} | ||
else { | ||
var storageFolder = Windows.Storage.ApplicationData.current.localFolder; | ||
file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
successCallback(URL.createObjectURL(storageFile)); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
@@ -249,14 +258,20 @@ | ||
} | ||
// decide which max pixels should be supported by targetWidth or targetHeight. | ||
if (targetWidth >= 1280 || targetHeight >= 960) { | ||
cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.large3M; | ||
} else if (targetWidth >= 1024 || targetHeight >= 768) { | ||
} | ||
else if (targetWidth >= 1024 || targetHeight >= 768) { | ||
cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.mediumXga; | ||
} else if (targetWidth >= 800 || targetHeight >= 600) { | ||
} | ||
else if (targetWidth >= 800 || targetHeight >= 600) { | ||
cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.mediumXga; | ||
} else if (targetWidth >= 640 || targetHeight >= 480) { | ||
} | ||
else if (targetWidth >= 640 || targetHeight >= 480) { | ||
cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.smallVga; | ||
} else if (targetWidth >= 320 || targetHeight >= 240) { | ||
} | ||
else if (targetWidth >= 320 || targetHeight >= 240) { | ||
cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.verySmallQvga; | ||
} else { | ||
} | ||
else { | ||
cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.highestAvailable; | ||
@@ -273,11 +288,10 @@ } | ||
} else { | ||
Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) { | ||
picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
var _imageUrl = URL.createObjectURL(storageFile); | ||
successCallback(_imageUrl); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
var storageFolder = Windows.Storage.ApplicationData.current.localFolder; | ||
picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
successCallback("ms-appdata:///local/" + storageFile.name); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
@@ -317,11 +331,10 @@ } | ||
} else { | ||
Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) { | ||
picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
var _imageUrl = URL.createObjectURL(storageFile); | ||
successCallback(_imageUrl); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
var storageFolder = Windows.Storage.ApplicationData.current.localFolder; | ||
picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) { | ||
successCallback("ms-appdata:///local/" + storageFile.name); | ||
}, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}, function () { | ||
errorCallback("Folder not access."); | ||
}); | ||
@@ -328,0 +341,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5007
23
384465
50