You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by he...@apache.org on 2013/05/22 23:40:12 UTC

[1/4] git commit: initial commit, added README file

Updated Branches:
  refs/heads/master 1a7a1fa68 -> 41691a326


initial commit, added README file


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/commit/9b337a16
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/tree/9b337a16
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/diff/9b337a16

Branch: refs/heads/master
Commit: 9b337a16c0dec50e91261eda337de213b08a7c16
Parents: 1a7a1fa
Author: hermwong <he...@gmail.com>
Authored: Wed May 22 14:36:35 2013 -0700
Committer: hermwong <he...@gmail.com>
Committed: Wed May 22 14:36:35 2013 -0700

----------------------------------------------------------------------
 README.md |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/9b337a16/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6716104
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+cordova-plugin-media-capture
+----------------------------


[3/4] git commit: added JS files from Cordova-JS

Posted by he...@apache.org.
added JS files from Cordova-JS


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/commit/90a7b8de
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/tree/90a7b8de
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/diff/90a7b8de

Branch: refs/heads/master
Commit: 90a7b8de3a358e1fd26b149e6139627f8005368d
Parents: 95562e0
Author: hermwong <he...@gmail.com>
Authored: Wed May 22 14:39:38 2013 -0700
Committer: hermwong <he...@gmail.com>
Committed: Wed May 22 14:39:38 2013 -0700

----------------------------------------------------------------------
 www/CaptureAudioOptions.js |   32 +++++++++++++
 www/CaptureError.js        |   40 +++++++++++++++++
 www/CaptureImageOptions.js |   30 ++++++++++++
 www/CaptureVideoOptions.js |   32 +++++++++++++
 www/ConfigurationData.js   |   36 +++++++++++++++
 www/MediaFile.js           |   55 +++++++++++++++++++++++
 www/MediaFileData.js       |   39 ++++++++++++++++
 www/capture.js             |   93 +++++++++++++++++++++++++++++++++++++++
 8 files changed, 357 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/90a7b8de/www/CaptureAudioOptions.js
----------------------------------------------------------------------
diff --git a/www/CaptureAudioOptions.js b/www/CaptureAudioOptions.js
new file mode 100644
index 0000000..b5f5605
--- /dev/null
+++ b/www/CaptureAudioOptions.js
@@ -0,0 +1,32 @@
+/*
+ *
+ * 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
+ *
+ *   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.
+ *
+*/
+
+/**
+ * Encapsulates all audio capture operation configuration options.
+ */
+var CaptureAudioOptions = function(){
+    // Upper limit of sound clips user can record. Value must be equal or greater than 1.
+    this.limit = 1;
+    // Maximum duration of a single sound clip in seconds.
+    this.duration = 0;
+};
+
+module.exports = CaptureAudioOptions;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/90a7b8de/www/CaptureError.js
----------------------------------------------------------------------
diff --git a/www/CaptureError.js b/www/CaptureError.js
new file mode 100644
index 0000000..6fb7a47
--- /dev/null
+++ b/www/CaptureError.js
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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
+ *
+ *   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.
+ *
+*/
+
+/**
+ * The CaptureError interface encapsulates all errors in the Capture API.
+ */
+var CaptureError = function(c) {
+   this.code = c || null;
+};
+
+// Camera or microphone failed to capture image or sound.
+CaptureError.CAPTURE_INTERNAL_ERR = 0;
+// Camera application or audio capture application is currently serving other capture request.
+CaptureError.CAPTURE_APPLICATION_BUSY = 1;
+// Invalid use of the API (e.g. limit parameter has value less than one).
+CaptureError.CAPTURE_INVALID_ARGUMENT = 2;
+// User exited camera application or audio capture application before capturing anything.
+CaptureError.CAPTURE_NO_MEDIA_FILES = 3;
+// The requested capture operation is not supported.
+CaptureError.CAPTURE_NOT_SUPPORTED = 20;
+
+module.exports = CaptureError;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/90a7b8de/www/CaptureImageOptions.js
----------------------------------------------------------------------
diff --git a/www/CaptureImageOptions.js b/www/CaptureImageOptions.js
new file mode 100644
index 0000000..1fb5615
--- /dev/null
+++ b/www/CaptureImageOptions.js
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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
+ *
+ *   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.
+ *
+*/
+
+/**
+ * Encapsulates all image capture operation configuration options.
+ */
+var CaptureImageOptions = function(){
+    // Upper limit of images user can take. Value must be equal or greater than 1.
+    this.limit = 1;
+};
+
+module.exports = CaptureImageOptions;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/90a7b8de/www/CaptureVideoOptions.js
----------------------------------------------------------------------
diff --git a/www/CaptureVideoOptions.js b/www/CaptureVideoOptions.js
new file mode 100644
index 0000000..adb306f
--- /dev/null
+++ b/www/CaptureVideoOptions.js
@@ -0,0 +1,32 @@
+/*
+ *
+ * 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
+ *
+ *   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.
+ *
+*/
+
+/**
+ * Encapsulates all video capture operation configuration options.
+ */
+var CaptureVideoOptions = function(){
+    // Upper limit of videos user can record. Value must be equal or greater than 1.
+    this.limit = 1;
+    // Maximum duration of a single video clip in seconds.
+    this.duration = 0;
+};
+
+module.exports = CaptureVideoOptions;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/90a7b8de/www/ConfigurationData.js
----------------------------------------------------------------------
diff --git a/www/ConfigurationData.js b/www/ConfigurationData.js
new file mode 100644
index 0000000..57cfbf5
--- /dev/null
+++ b/www/ConfigurationData.js
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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
+ *
+ *   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.
+ *
+*/
+
+/**
+ * Encapsulates a set of parameters that the capture device supports.
+ */
+function ConfigurationData() {
+    // The ASCII-encoded string in lower case representing the media type.
+    this.type = null;
+    // The height attribute represents height of the image or video in pixels.
+    // In the case of a sound clip this attribute has value 0.
+    this.height = 0;
+    // The width attribute represents width of the image or video in pixels.
+    // In the case of a sound clip this attribute has value 0
+    this.width = 0;
+}
+
+module.exports = ConfigurationData;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/90a7b8de/www/MediaFile.js
----------------------------------------------------------------------
diff --git a/www/MediaFile.js b/www/MediaFile.js
new file mode 100644
index 0000000..629c498
--- /dev/null
+++ b/www/MediaFile.js
@@ -0,0 +1,55 @@
+/*
+ *
+ * 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
+ *
+ *   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.
+ *
+*/
+
+var utils = require('cordova/utils'),
+    exec = require('cordova/exec'),
+    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
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ */
+MediaFile.prototype.getFormatData = function(successCallback, errorCallback) {
+    if (typeof this.fullPath === "undefined" || this.fullPath === null) {
+        errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+    } else {
+        exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]);
+    }
+};
+
+module.exports = MediaFile;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/90a7b8de/www/MediaFileData.js
----------------------------------------------------------------------
diff --git a/www/MediaFileData.js b/www/MediaFileData.js
new file mode 100644
index 0000000..75e467b
--- /dev/null
+++ b/www/MediaFileData.js
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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
+ *
+ *   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.
+ *
+*/
+
+/**
+ * MediaFileData encapsulates format information of a media file.
+ *
+ * @param {DOMString} codecs
+ * @param {long} bitrate
+ * @param {long} height
+ * @param {long} width
+ * @param {float} duration
+ */
+var MediaFileData = function(codecs, bitrate, height, width, duration){
+    this.codecs = codecs || null;
+    this.bitrate = bitrate || 0;
+    this.height = height || 0;
+    this.width = width || 0;
+    this.duration = duration || 0;
+};
+
+module.exports = MediaFileData;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/90a7b8de/www/capture.js
----------------------------------------------------------------------
diff --git a/www/capture.js b/www/capture.js
new file mode 100644
index 0000000..bf59f4a
--- /dev/null
+++ b/www/capture.js
@@ -0,0 +1,93 @@
+/*
+ *
+ * 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
+ *
+ *   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.
+ *
+*/
+
+var exec = require('cordova/exec'),
+    MediaFile = require('cordova/plugin/MediaFile');
+
+/**
+ * Launches a capture of different types.
+ *
+ * @param (DOMString} type
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {CaptureVideoOptions} options
+ */
+function _capture(type, successCallback, errorCallback, options) {
+    var win = function(pluginResult) {
+        var mediaFiles = [];
+        var i;
+        for (i = 0; i < pluginResult.length; i++) {
+            var mediaFile = new MediaFile();
+            mediaFile.name = pluginResult[i].name;
+            mediaFile.fullPath = pluginResult[i].fullPath;
+            mediaFile.type = pluginResult[i].type;
+            mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate;
+            mediaFile.size = pluginResult[i].size;
+            mediaFiles.push(mediaFile);
+        }
+        successCallback(mediaFiles);
+    };
+    exec(win, errorCallback, "Capture", type, [options]);
+}
+/**
+ * The Capture interface exposes an interface to the camera and microphone of the hosting device.
+ */
+function Capture() {
+    this.supportedAudioModes = [];
+    this.supportedImageModes = [];
+    this.supportedVideoModes = [];
+}
+
+/**
+ * Launch audio recorder application for recording audio clip(s).
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {CaptureAudioOptions} options
+ */
+Capture.prototype.captureAudio = function(successCallback, errorCallback, options){
+    _capture("captureAudio", successCallback, errorCallback, options);
+};
+
+/**
+ * Launch camera application for taking image(s).
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {CaptureImageOptions} options
+ */
+Capture.prototype.captureImage = function(successCallback, errorCallback, options){
+    _capture("captureImage", successCallback, errorCallback, options);
+};
+
+/**
+ * Launch device camera application for recording video(s).
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {CaptureVideoOptions} options
+ */
+Capture.prototype.captureVideo = function(successCallback, errorCallback, options){
+    _capture("captureVideo", successCallback, errorCallback, options);
+};
+
+
+module.exports = new Capture();


[4/4] git commit: initial config added

Posted by he...@apache.org.
initial config added


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/commit/41691a32
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/tree/41691a32
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/diff/41691a32

Branch: refs/heads/master
Commit: 41691a326c0b9e1d600774d6a1f4dfcc195294e5
Parents: 90a7b8d
Author: hermwong <he...@gmail.com>
Authored: Wed May 22 14:39:57 2013 -0700
Committer: hermwong <he...@gmail.com>
Committed: Wed May 22 14:39:57 2013 -0700

----------------------------------------------------------------------
 plugin.xml |   47 +++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/41691a32/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 0eb0f67..4564d95 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,10 +2,38 @@
 
 <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
 xmlns:android="http://schemas.android.com/apk/res/android"
-id="org.apache.cordova.core">
+id="org.apache.cordova.core.Capture"
     version="0.1.0">
     <name>Capture</name>
 
+    <js-module src="www/CaptureAudioOptions.js" name="CaptureAudioOptions">
+        <clobbers target="CaptureAudioOptions" />
+    </js-module>
+    
+    <js-module src="www/CaptureImageOptions.js" name="CaptureImageOptions">
+        <clobbers target="CaptureImageOptions" />
+    </js-module>
+
+    <js-module src="www/CaptureVideoOptions.js" name="CaptureVideoOptions">
+        <clobbers target="CaptureVideoOptions" />
+    </js-module>
+        
+    <js-module src="www/CaptureError.js" name="CaptureError">
+        <clobbers target="CaptureError" />
+    </js-module>
+
+    <js-module src="www/MediaFileData.js" name="MediaFileData">
+        <clobbers target="MediaFileData" />
+    </js-module>
+        
+    <js-module src="www/MediaFile.js" name="MediaFile">
+        <clobbers target="MediaFile" />
+    </js-module>
+    
+    <js-module src="www/capture.js" name="capture">
+        <clobbers target="navigator.device.capture" />
+    </js-module>
+
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/cordova/plugins">
@@ -13,5 +41,20 @@ id="org.apache.cordova.core">
         </config-file>
 
         <source-file src="Capture.java" target-dir="org/apache/cordova/core" />
-       </platform>
+    </platform>
+    
+    <!-- ios -->
+    <platform name="ios">    
+        <config-file target="config.xml" parent="/*">
+            <feature name="Capture">
+                <param name="ios-package" value="CDVCapture" /> 
+            </feature>
+        </config-file>
+        <header-file src="src/ios/CDVAvailability.h" />
+        <header-file src="src/ios/CDVFile.h" />
+        <header-file src="src/ios/CDVJSON.h" />
+        <header-file src="src/ios/CDVCapture.h" />
+        <source-file src="src/ios/CDVCapture.m" />
+    </platform>
+        
 </plugin>


[2/4] git commit: added native iOS files

Posted by he...@apache.org.
added native iOS files


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/commit/95562e02
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/tree/95562e02
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/diff/95562e02

Branch: refs/heads/master
Commit: 95562e020ce14b14893b9cc3c9d2394b2e1fc784
Parents: 9b337a1
Author: hermwong <he...@gmail.com>
Authored: Wed May 22 14:37:36 2013 -0700
Committer: hermwong <he...@gmail.com>
Committed: Wed May 22 14:37:36 2013 -0700

----------------------------------------------------------------------
 src/ios/CDVAvailability.h |   88 +++++
 src/ios/CDVCapture.h      |  118 ++++++
 src/ios/CDVCapture.m      |  845 ++++++++++++++++++++++++++++++++++++++++
 src/ios/CDVFile.h         |  106 +++++
 src/ios/CDVJSON.h         |   30 ++
 5 files changed, 1187 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/95562e02/src/ios/CDVAvailability.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVAvailability.h b/src/ios/CDVAvailability.h
new file mode 100644
index 0000000..b288522
--- /dev/null
+++ b/src/ios/CDVAvailability.h
@@ -0,0 +1,88 @@
+/*
+ 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
+
+ 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.
+ */
+
+#define __CORDOVA_IOS__
+
+#define __CORDOVA_0_9_6 906
+#define __CORDOVA_1_0_0 10000
+#define __CORDOVA_1_1_0 10100
+#define __CORDOVA_1_2_0 10200
+#define __CORDOVA_1_3_0 10300
+#define __CORDOVA_1_4_0 10400
+#define __CORDOVA_1_4_1 10401
+#define __CORDOVA_1_5_0 10500
+#define __CORDOVA_1_6_0 10600
+#define __CORDOVA_1_6_1 10601
+#define __CORDOVA_1_7_0 10700
+#define __CORDOVA_1_8_0 10800
+#define __CORDOVA_1_8_1 10801
+#define __CORDOVA_1_9_0 10900
+#define __CORDOVA_2_0_0 20000
+#define __CORDOVA_2_1_0 20100
+#define __CORDOVA_2_2_0 20200
+#define __CORDOVA_2_3_0 20300
+#define __CORDOVA_2_4_0 20400
+#define __CORDOVA_2_5_0 20500
+#define __CORDOVA_2_6_0 20600
+#define __CORDOVA_2_7_0 20700
+#define __CORDOVA_NA 99999      /* not available */
+
+/*
+ #if CORDOVA_VERSION_MIN_REQUIRED >= __CORDOVA_1_7_0
+    // do something when its at least 1.7.0
+ #else
+    // do something else (non 1.7.0)
+ #endif
+ */
+#ifndef CORDOVA_VERSION_MIN_REQUIRED
+    #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_2_7_0
+#endif
+
+/*
+ Returns YES if it is at least version specified as NSString(X)
+ Usage:
+     if (IsAtLeastiOSVersion(@"5.1")) {
+         // do something for iOS 5.1 or greater
+     }
+ */
+#define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending)
+
+#define CDV_IsIPad() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad))
+
+#define CDV_IsIPhone5() ([[UIScreen mainScreen] bounds].size.height == 568 && [[UIScreen mainScreen] bounds].size.width == 320)
+
+/* Return the string version of the decimal version */
+#define CDV_VERSION [NSString stringWithFormat:@"%d.%d.%d", \
+    (CORDOVA_VERSION_MIN_REQUIRED / 10000),                 \
+    (CORDOVA_VERSION_MIN_REQUIRED % 10000) / 100,           \
+    (CORDOVA_VERSION_MIN_REQUIRED % 10000) % 100]
+
+#ifdef __clang__
+    #define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg)))
+#else
+    #define CDV_DEPRECATED(version, msg) __attribute__((deprecated()))
+#endif
+
+// Enable this to log all exec() calls.
+#define CDV_ENABLE_EXEC_LOGGING 0
+#if CDV_ENABLE_EXEC_LOGGING
+    #define CDV_EXEC_LOG NSLog
+#else
+    #define CDV_EXEC_LOG(...) do {} while (NO)
+#endif

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/95562e02/src/ios/CDVCapture.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVCapture.h b/src/ios/CDVCapture.h
new file mode 100644
index 0000000..afb82b4
--- /dev/null
+++ b/src/ios/CDVCapture.h
@@ -0,0 +1,118 @@
+/*
+ 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
+
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import <MobileCoreServices/MobileCoreServices.h>
+#import <AVFoundation/AVFoundation.h>
+#import "CDVPlugin.h"
+#import "CDVFile.h"
+
+enum CDVCaptureError {
+    CAPTURE_INTERNAL_ERR = 0,
+    CAPTURE_APPLICATION_BUSY = 1,
+    CAPTURE_INVALID_ARGUMENT = 2,
+    CAPTURE_NO_MEDIA_FILES = 3,
+    CAPTURE_NOT_SUPPORTED = 20
+};
+typedef NSUInteger CDVCaptureError;
+
+@interface CDVImagePicker : UIImagePickerController
+{
+    NSString* callbackid;
+    NSInteger quality;
+    NSString* mimeType;
+}
+@property (assign) NSInteger quality;
+@property (copy)   NSString* callbackId;
+@property (copy)   NSString* mimeType;
+
+@end
+
+@interface CDVCapture : CDVPlugin <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
+{
+    CDVImagePicker* pickerController;
+    BOOL inUse;
+}
+@property BOOL inUse;
+- (void)captureAudio:(CDVInvokedUrlCommand*)command;
+- (void)captureImage:(CDVInvokedUrlCommand*)command;
+- (CDVPluginResult*)processImage:(UIImage*)image type:(NSString*)mimeType forCallbackId:(NSString*)callbackId;
+- (void)captureVideo:(CDVInvokedUrlCommand*)command;
+- (CDVPluginResult*)processVideo:(NSString*)moviePath forCallbackId:(NSString*)callbackId;
+- (void)getMediaModes:(CDVInvokedUrlCommand*)command;
+- (void)getFormatData:(CDVInvokedUrlCommand*)command;
+- (NSDictionary*)getMediaDictionaryFromPath:(NSString*)fullPath ofType:(NSString*)type;
+- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info;
+- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo;
+- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker;
+
+@end
+
+@interface CDVAudioNavigationController : UINavigationController
+
+@end
+
+/* AudioRecorderViewController is used to create a simple view for audio recording.
+ *  It is created from [Capture captureAudio].  It creates a very simple interface for
+ *  recording by presenting just a record/stop button and a Done button to close the view.
+ *  The recording time is displayed and recording for a specified duration is supported. When duration
+ *  is specified there is no UI to the user - recording just stops when the specified
+ *  duration is reached.  The UI has been minimized to avoid localization.
+ */
+@interface CDVAudioRecorderViewController : UIViewController <AVAudioRecorderDelegate>
+{
+    CDVCaptureError errorCode;
+    NSString* callbackId;
+    NSNumber* duration;
+    CDVCapture* captureCommand;
+    UIBarButtonItem* doneButton;
+    UIView* recordingView;
+    UIButton* recordButton;
+    UIImage* recordImage;
+    UIImage* stopRecordImage;
+    UILabel* timerLabel;
+    AVAudioRecorder* avRecorder;
+    AVAudioSession* avSession;
+    CDVPluginResult* pluginResult;
+    NSTimer* timer;
+    BOOL isTimed;
+}
+@property (nonatomic) CDVCaptureError errorCode;
+@property (nonatomic, copy) NSString* callbackId;
+@property (nonatomic, copy) NSNumber* duration;
+@property (nonatomic, strong) CDVCapture* captureCommand;
+@property (nonatomic, strong) UIBarButtonItem* doneButton;
+@property (nonatomic, strong) UIView* recordingView;
+@property (nonatomic, strong) UIButton* recordButton;
+@property (nonatomic, strong) UIImage* recordImage;
+@property (nonatomic, strong) UIImage* stopRecordImage;
+@property (nonatomic, strong) UILabel* timerLabel;
+@property (nonatomic, strong) AVAudioRecorder* avRecorder;
+@property (nonatomic, strong) AVAudioSession* avSession;
+@property (nonatomic, strong) CDVPluginResult* pluginResult;
+@property (nonatomic, strong) NSTimer* timer;
+@property (nonatomic) BOOL isTimed;
+
+- (id)initWithCommand:(CDVPlugin*)theCommand duration:(NSNumber*)theDuration callbackId:(NSString*)theCallbackId;
+- (void)processButton:(id)sender;
+- (void)stopRecordingCleanup;
+- (void)dismissAudioView:(id)sender;
+- (NSString*)formatTime:(int)interval;
+- (void)updateTime;
+@end

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/95562e02/src/ios/CDVCapture.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVCapture.m b/src/ios/CDVCapture.m
new file mode 100644
index 0000000..6b7ed44
--- /dev/null
+++ b/src/ios/CDVCapture.m
@@ -0,0 +1,845 @@
+/*
+ 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
+
+ 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.
+ */
+
+#import "CDVCapture.h"
+#import "CDVJSON.h"
+#import "CDVAvailability.h"
+
+#define kW3CMediaFormatHeight @"height"
+#define kW3CMediaFormatWidth @"width"
+#define kW3CMediaFormatCodecs @"codecs"
+#define kW3CMediaFormatBitrate @"bitrate"
+#define kW3CMediaFormatDuration @"duration"
+#define kW3CMediaModeType @"type"
+
+@implementation CDVImagePicker
+
+@synthesize quality;
+@synthesize callbackId;
+@synthesize mimeType;
+
+- (uint64_t)accessibilityTraits
+{
+    NSString* systemVersion = [[UIDevice currentDevice] systemVersion];
+
+    if (([systemVersion compare:@"4.0" options:NSNumericSearch] != NSOrderedAscending)) { // this means system version is not less than 4.0
+        return UIAccessibilityTraitStartsMediaSession;
+    }
+
+    return UIAccessibilityTraitNone;
+}
+
+@end
+
+@implementation CDVCapture
+@synthesize inUse;
+
+- (id)initWithWebView:(UIWebView*)theWebView
+{
+    self = (CDVCapture*)[super initWithWebView:theWebView];
+    if (self) {
+        self.inUse = NO;
+    }
+    return self;
+}
+
+- (void)captureAudio:(CDVInvokedUrlCommand*)command
+{
+    NSString* callbackId = command.callbackId;
+    NSDictionary* options = [command.arguments objectAtIndex:0];
+
+    if ([options isKindOfClass:[NSNull class]]) {
+        options = [NSDictionary dictionary];
+    }
+
+    NSNumber* duration = [options objectForKey:@"duration"];
+    // the default value of duration is 0 so use nil (no duration) if default value
+    if (duration) {
+        duration = [duration doubleValue] == 0 ? nil : duration;
+    }
+    CDVPluginResult* result = nil;
+
+    if (NSClassFromString(@"AVAudioRecorder") == nil) {
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_NOT_SUPPORTED];
+    } else if (self.inUse == YES) {
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_APPLICATION_BUSY];
+    } else {
+        // all the work occurs here
+        CDVAudioRecorderViewController* audioViewController = [[CDVAudioRecorderViewController alloc] initWithCommand:self duration:duration callbackId:callbackId];
+
+        // Now create a nav controller and display the view...
+        CDVAudioNavigationController* navController = [[CDVAudioNavigationController alloc] initWithRootViewController:audioViewController];
+
+        self.inUse = YES;
+
+        if ([self.viewController respondsToSelector:@selector(presentViewController:::)]) {
+            [self.viewController presentViewController:navController animated:YES completion:nil];
+        } else {
+            [self.viewController presentModalViewController:navController animated:YES];
+        }
+    }
+
+    if (result) {
+        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
+    }
+}
+
+- (void)captureImage:(CDVInvokedUrlCommand*)command
+{
+    NSString* callbackId = command.callbackId;
+    NSDictionary* options = [command.arguments objectAtIndex:0];
+
+    if ([options isKindOfClass:[NSNull class]]) {
+        options = [NSDictionary dictionary];
+    }
+
+    // options could contain limit and mode neither of which are supported at this time
+    // taking more than one picture (limit) is only supported if provide own controls via cameraOverlayView property
+    // can support mode in OS
+
+    if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
+        NSLog(@"Capture.imageCapture: camera not available.");
+        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_NOT_SUPPORTED];
+        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
+    } else {
+        if (pickerController == nil) {
+            pickerController = [[CDVImagePicker alloc] init];
+        }
+
+        pickerController.delegate = self;
+        pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
+        pickerController.allowsEditing = NO;
+        if ([pickerController respondsToSelector:@selector(mediaTypes)]) {
+            // iOS 3.0
+            pickerController.mediaTypes = [NSArray arrayWithObjects:(NSString*)kUTTypeImage, nil];
+        }
+
+        /*if ([pickerController respondsToSelector:@selector(cameraCaptureMode)]){
+            // iOS 4.0
+            pickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
+            pickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
+            pickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
+        }*/
+        // CDVImagePicker specific property
+        pickerController.callbackId = callbackId;
+
+        if ([self.viewController respondsToSelector:@selector(presentViewController:::)]) {
+            [self.viewController presentViewController:pickerController animated:YES completion:nil];
+        } else {
+            [self.viewController presentModalViewController:pickerController animated:YES];
+        }
+    }
+}
+
+/* Process a still image from the camera.
+ * IN:
+ *  UIImage* image - the UIImage data returned from the camera
+ *  NSString* callbackId
+ */
+- (CDVPluginResult*)processImage:(UIImage*)image type:(NSString*)mimeType forCallbackId:(NSString*)callbackId
+{
+    CDVPluginResult* result = nil;
+
+    // save the image to photo album
+    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
+
+    NSData* data = nil;
+    if (mimeType && [mimeType isEqualToString:@"image/png"]) {
+        data = UIImagePNGRepresentation(image);
+    } else {
+        data = UIImageJPEGRepresentation(image, 0.5);
+    }
+
+    // write to temp directory and return URI
+    NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];   // use file system temporary directory
+    NSError* err = nil;
+    NSFileManager* fileMgr = [[NSFileManager alloc] init];
+
+    // generate unique file name
+    NSString* filePath;
+    int i = 1;
+    do {
+        filePath = [NSString stringWithFormat:@"%@/photo_%03d.jpg", docsPath, i++];
+    } while ([fileMgr fileExistsAtPath:filePath]);
+
+    if (![data writeToFile:filePath options:NSAtomicWrite error:&err]) {
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageToErrorObject:CAPTURE_INTERNAL_ERR];
+        if (err) {
+            NSLog(@"Error saving image: %@", [err localizedDescription]);
+        }
+    } else {
+        // create MediaFile object
+
+        NSDictionary* fileDict = [self getMediaDictionaryFromPath:filePath ofType:mimeType];
+        NSArray* fileArray = [NSArray arrayWithObject:fileDict];
+
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:fileArray];
+    }
+
+    return result;
+}
+
+- (void)captureVideo:(CDVInvokedUrlCommand*)command
+{
+    NSString* callbackId = command.callbackId;
+    NSDictionary* options = [command.arguments objectAtIndex:0];
+
+    if ([options isKindOfClass:[NSNull class]]) {
+        options = [NSDictionary dictionary];
+    }
+
+    // options could contain limit, duration and mode, only duration is supported (but is not due to apple bug)
+    // taking more than one video (limit) is only supported if provide own controls via cameraOverlayView property
+    // NSNumber* duration = [options objectForKey:@"duration"];
+    NSString* mediaType = nil;
+
+    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
+        // there is a camera, it is available, make sure it can do movies
+        pickerController = [[CDVImagePicker alloc] init];
+
+        NSArray* types = nil;
+        if ([UIImagePickerController respondsToSelector:@selector(availableMediaTypesForSourceType:)]) {
+            types = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
+            // NSLog(@"MediaTypes: %@", [types description]);
+
+            if ([types containsObject:(NSString*)kUTTypeMovie]) {
+                mediaType = (NSString*)kUTTypeMovie;
+            } else if ([types containsObject:(NSString*)kUTTypeVideo]) {
+                mediaType = (NSString*)kUTTypeVideo;
+            }
+        }
+    }
+    if (!mediaType) {
+        // don't have video camera return error
+        NSLog(@"Capture.captureVideo: video mode not available.");
+        CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_NOT_SUPPORTED];
+        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
+        pickerController = nil;
+    } else {
+        pickerController.delegate = self;
+        pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
+        pickerController.allowsEditing = NO;
+        // iOS 3.0
+        pickerController.mediaTypes = [NSArray arrayWithObjects:mediaType, nil];
+
+        /*if ([mediaType isEqualToString:(NSString*)kUTTypeMovie]){
+            if (duration) {
+                pickerController.videoMaximumDuration = [duration doubleValue];
+            }
+            //NSLog(@"pickerController.videoMaximumDuration = %f", pickerController.videoMaximumDuration);
+        }*/
+
+        // iOS 4.0
+        if ([pickerController respondsToSelector:@selector(cameraCaptureMode)]) {
+            pickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
+            // pickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
+            // pickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
+            // pickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
+        }
+        // CDVImagePicker specific property
+        pickerController.callbackId = callbackId;
+
+        if ([self.viewController respondsToSelector:@selector(presentViewController:::)]) {
+            [self.viewController presentViewController:pickerController animated:YES completion:nil];
+        } else {
+            [self.viewController presentModalViewController:pickerController animated:YES];
+        }
+    }
+}
+
+- (CDVPluginResult*)processVideo:(NSString*)moviePath forCallbackId:(NSString*)callbackId
+{
+    // save the movie to photo album (only avail as of iOS 3.1)
+
+    /* don't need, it should automatically get saved
+     NSLog(@"can save %@: %d ?", moviePath, UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(moviePath));
+    if (&UIVideoAtPathIsCompatibleWithSavedPhotosAlbum != NULL && UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(moviePath) == YES) {
+        NSLog(@"try to save movie");
+        UISaveVideoAtPathToSavedPhotosAlbum(moviePath, nil, nil, nil);
+        NSLog(@"finished saving movie");
+    }*/
+    // create MediaFile object
+    NSDictionary* fileDict = [self getMediaDictionaryFromPath:moviePath ofType:nil];
+    NSArray* fileArray = [NSArray arrayWithObject:fileDict];
+
+    return [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:fileArray];
+}
+
+- (void)getMediaModes:(CDVInvokedUrlCommand*)command
+{
+    // NSString* callbackId = [arguments objectAtIndex:0];
+    // NSMutableDictionary* imageModes = nil;
+    NSArray* imageArray = nil;
+    NSArray* movieArray = nil;
+    NSArray* audioArray = nil;
+
+    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
+        // there is a camera, find the modes
+        // can get image/jpeg or image/png from camera
+
+        /* can't find a way to get the default height and width and other info
+         * for images/movies taken with UIImagePickerController
+         */
+        NSDictionary* jpg = [NSDictionary dictionaryWithObjectsAndKeys:
+            [NSNumber numberWithInt:0], kW3CMediaFormatHeight,
+            [NSNumber numberWithInt:0], kW3CMediaFormatWidth,
+            @"image/jpeg", kW3CMediaModeType,
+            nil];
+        NSDictionary* png = [NSDictionary dictionaryWithObjectsAndKeys:
+            [NSNumber numberWithInt:0], kW3CMediaFormatHeight,
+            [NSNumber numberWithInt:0], kW3CMediaFormatWidth,
+            @"image/png", kW3CMediaModeType,
+            nil];
+        imageArray = [NSArray arrayWithObjects:jpg, png, nil];
+
+        if ([UIImagePickerController respondsToSelector:@selector(availableMediaTypesForSourceType:)]) {
+            NSArray* types = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
+
+            if ([types containsObject:(NSString*)kUTTypeMovie]) {
+                NSDictionary* mov = [NSDictionary dictionaryWithObjectsAndKeys:
+                    [NSNumber numberWithInt:0], kW3CMediaFormatHeight,
+                    [NSNumber numberWithInt:0], kW3CMediaFormatWidth,
+                    @"video/quicktime", kW3CMediaModeType,
+                    nil];
+                movieArray = [NSArray arrayWithObject:mov];
+            }
+        }
+    }
+    NSDictionary* modes = [NSDictionary dictionaryWithObjectsAndKeys:
+        imageArray ? (NSObject*)                          imageArray:[NSNull null], @"image",
+        movieArray ? (NSObject*)                          movieArray:[NSNull null], @"video",
+        audioArray ? (NSObject*)                          audioArray:[NSNull null], @"audio",
+        nil];
+    NSString* jsString = [NSString stringWithFormat:@"navigator.device.capture.setSupportedModes(%@);", [modes JSONString]];
+    [self.commandDelegate evalJs:jsString];
+}
+
+- (void)getFormatData:(CDVInvokedUrlCommand*)command
+{
+    NSString* callbackId = command.callbackId;
+    // existence of fullPath checked on JS side
+    NSString* fullPath = [command.arguments objectAtIndex:0];
+    // mimeType could be null
+    NSString* mimeType = nil;
+
+    if ([command.arguments count] > 1) {
+        mimeType = [command.arguments objectAtIndex:1];
+    }
+    BOOL bError = NO;
+    CDVCaptureError errorCode = CAPTURE_INTERNAL_ERR;
+    CDVPluginResult* result = nil;
+
+    if (!mimeType || [mimeType isKindOfClass:[NSNull class]]) {
+        // try to determine mime type if not provided
+        id command = [self.commandDelegate getCommandInstance:@"File"];
+        bError = !([command isKindOfClass:[CDVFile class]]);
+        if (!bError) {
+            CDVFile* cdvFile = (CDVFile*)command;
+            mimeType = [cdvFile getMimeTypeFromPath:fullPath];
+            if (!mimeType) {
+                // can't do much without mimeType, return error
+                bError = YES;
+                errorCode = CAPTURE_INVALID_ARGUMENT;
+            }
+        }
+    }
+    if (!bError) {
+        // create and initialize return dictionary
+        NSMutableDictionary* formatData = [NSMutableDictionary dictionaryWithCapacity:5];
+        [formatData setObject:[NSNull null] forKey:kW3CMediaFormatCodecs];
+        [formatData setObject:[NSNumber numberWithInt:0] forKey:kW3CMediaFormatBitrate];
+        [formatData setObject:[NSNumber numberWithInt:0] forKey:kW3CMediaFormatHeight];
+        [formatData setObject:[NSNumber numberWithInt:0] forKey:kW3CMediaFormatWidth];
+        [formatData setObject:[NSNumber numberWithInt:0] forKey:kW3CMediaFormatDuration];
+
+        if ([mimeType rangeOfString:@"image/"].location != NSNotFound) {
+            UIImage* image = [UIImage imageWithContentsOfFile:fullPath];
+            if (image) {
+                CGSize imgSize = [image size];
+                [formatData setObject:[NSNumber numberWithInteger:imgSize.width] forKey:kW3CMediaFormatWidth];
+                [formatData setObject:[NSNumber numberWithInteger:imgSize.height] forKey:kW3CMediaFormatHeight];
+            }
+        } else if (([mimeType rangeOfString:@"video/"].location != NSNotFound) && (NSClassFromString(@"AVURLAsset") != nil)) {
+            NSURL* movieURL = [NSURL fileURLWithPath:fullPath];
+            AVURLAsset* movieAsset = [[AVURLAsset alloc] initWithURL:movieURL options:nil];
+            CMTime duration = [movieAsset duration];
+            [formatData setObject:[NSNumber numberWithFloat:CMTimeGetSeconds(duration)]  forKey:kW3CMediaFormatDuration];
+
+            NSArray* allVideoTracks = [movieAsset tracksWithMediaType:AVMediaTypeVideo];
+            if ([allVideoTracks count] > 0) {
+                AVAssetTrack* track = [[movieAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
+                CGSize size = [track naturalSize];
+
+                [formatData setObject:[NSNumber numberWithFloat:size.height] forKey:kW3CMediaFormatHeight];
+                [formatData setObject:[NSNumber numberWithFloat:size.width] forKey:kW3CMediaFormatWidth];
+                // not sure how to get codecs or bitrate???
+                // AVMetadataItem
+                // AudioFile
+            } else {
+                NSLog(@"No video tracks found for %@", fullPath);
+            }
+        } else if ([mimeType rangeOfString:@"audio/"].location != NSNotFound) {
+            if (NSClassFromString(@"AVAudioPlayer") != nil) {
+                NSURL* fileURL = [NSURL fileURLWithPath:fullPath];
+                NSError* err = nil;
+
+                AVAudioPlayer* avPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:&err];
+                if (!err) {
+                    // get the data
+                    [formatData setObject:[NSNumber numberWithDouble:[avPlayer duration]] forKey:kW3CMediaFormatDuration];
+                    if ([avPlayer respondsToSelector:@selector(settings)]) {
+                        NSDictionary* info = [avPlayer settings];
+                        NSNumber* bitRate = [info objectForKey:AVEncoderBitRateKey];
+                        if (bitRate) {
+                            [formatData setObject:bitRate forKey:kW3CMediaFormatBitrate];
+                        }
+                    }
+                } // else leave data init'ed to 0
+            }
+        }
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:formatData];
+        // NSLog(@"getFormatData: %@", [formatData description]);
+    }
+    if (bError) {
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:errorCode];
+    }
+    if (result) {
+        [self.commandDelegate sendPluginResult:result callbackId:callbackId];
+    }
+}
+
+- (NSDictionary*)getMediaDictionaryFromPath:(NSString*)fullPath ofType:(NSString*)type
+{
+    NSFileManager* fileMgr = [[NSFileManager alloc] init];
+    NSMutableDictionary* fileDict = [NSMutableDictionary dictionaryWithCapacity:5];
+
+    [fileDict setObject:[fullPath lastPathComponent] forKey:@"name"];
+    [fileDict setObject:fullPath forKey:@"fullPath"];
+    // determine type
+    if (!type) {
+        id command = [self.commandDelegate getCommandInstance:@"File"];
+        if ([command isKindOfClass:[CDVFile class]]) {
+            CDVFile* cdvFile = (CDVFile*)command;
+            NSString* mimeType = [cdvFile getMimeTypeFromPath:fullPath];
+            [fileDict setObject:(mimeType != nil ? (NSObject*)mimeType : [NSNull null]) forKey:@"type"];
+        }
+    }
+    NSDictionary* fileAttrs = [fileMgr attributesOfItemAtPath:fullPath error:nil];
+    [fileDict setObject:[NSNumber numberWithUnsignedLongLong:[fileAttrs fileSize]] forKey:@"size"];
+    NSDate* modDate = [fileAttrs fileModificationDate];
+    NSNumber* msDate = [NSNumber numberWithDouble:[modDate timeIntervalSince1970] * 1000];
+    [fileDict setObject:msDate forKey:@"lastModifiedDate"];
+
+    return fileDict;
+}
+
+- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo
+{
+    // older api calls new one
+    [self imagePickerController:picker didFinishPickingMediaWithInfo:editingInfo];
+}
+
+/* Called when image/movie is finished recording.
+ * Calls success or error code as appropriate
+ * if successful, result  contains an array (with just one entry since can only get one image unless build own camera UI) of MediaFile object representing the image
+ *      name
+ *      fullPath
+ *      type
+ *      lastModifiedDate
+ *      size
+ */
+- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
+{
+    CDVImagePicker* cameraPicker = (CDVImagePicker*)picker;
+    NSString* callbackId = cameraPicker.callbackId;
+
+    if ([picker respondsToSelector:@selector(presentingViewController)]) {
+        [[picker presentingViewController] dismissModalViewControllerAnimated:YES];
+    } else {
+        [[picker parentViewController] dismissModalViewControllerAnimated:YES];
+    }
+
+    CDVPluginResult* result = nil;
+
+    UIImage* image = nil;
+    NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
+    if (!mediaType || [mediaType isEqualToString:(NSString*)kUTTypeImage]) {
+        // mediaType is nil then only option is UIImagePickerControllerOriginalImage
+        if ([UIImagePickerController respondsToSelector:@selector(allowsEditing)] &&
+            (cameraPicker.allowsEditing && [info objectForKey:UIImagePickerControllerEditedImage])) {
+            image = [info objectForKey:UIImagePickerControllerEditedImage];
+        } else {
+            image = [info objectForKey:UIImagePickerControllerOriginalImage];
+        }
+    }
+    if (image != nil) {
+        // mediaType was image
+        result = [self processImage:image type:cameraPicker.mimeType forCallbackId:callbackId];
+    } else if ([mediaType isEqualToString:(NSString*)kUTTypeMovie]) {
+        // process video
+        NSString* moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
+        if (moviePath) {
+            result = [self processVideo:moviePath forCallbackId:callbackId];
+        }
+    }
+    if (!result) {
+        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_INTERNAL_ERR];
+    }
+    [self.commandDelegate sendPluginResult:result callbackId:callbackId];
+    pickerController = nil;
+}
+
+- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker
+{
+    CDVImagePicker* cameraPicker = (CDVImagePicker*)picker;
+    NSString* callbackId = cameraPicker.callbackId;
+
+    if ([picker respondsToSelector:@selector(presentingViewController)]) {
+        [[picker presentingViewController] dismissModalViewControllerAnimated:YES];
+    } else {
+        [[picker parentViewController] dismissModalViewControllerAnimated:YES];
+    }
+
+    CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:CAPTURE_NO_MEDIA_FILES];
+    [self.commandDelegate sendPluginResult:result callbackId:callbackId];
+    pickerController = nil;
+}
+
+@end
+
+@implementation CDVAudioNavigationController
+
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
+    - (NSUInteger)supportedInterfaceOrientations
+    {
+        // delegate to CVDAudioRecorderViewController
+        return [self.topViewController supportedInterfaceOrientations];
+    }
+#endif
+
+@end
+
+@implementation CDVAudioRecorderViewController
+@synthesize errorCode, callbackId, duration, captureCommand, doneButton, recordingView, recordButton, recordImage, stopRecordImage, timerLabel, avRecorder, avSession, pluginResult, timer, isTimed;
+
+- (NSString*)resolveImageResource:(NSString*)resource
+{
+    NSString* systemVersion = [[UIDevice currentDevice] systemVersion];
+    BOOL isLessThaniOS4 = ([systemVersion compare:@"4.0" options:NSNumericSearch] == NSOrderedAscending);
+
+    // the iPad image (nor retina) differentiation code was not in 3.x, and we have to explicitly set the path
+    // if user wants iPhone only app to run on iPad they must remove *~ipad.* images from capture.bundle
+    if (isLessThaniOS4) {
+        NSString* iPadResource = [NSString stringWithFormat:@"%@~ipad.png", resource];
+        if (CDV_IsIPad() && [UIImage imageNamed:iPadResource]) {
+            return iPadResource;
+        } else {
+            return [NSString stringWithFormat:@"%@.png", resource];
+        }
+    }
+
+    return resource;
+}
+
+- (id)initWithCommand:(CDVCapture*)theCommand duration:(NSNumber*)theDuration callbackId:(NSString*)theCallbackId
+{
+    if ((self = [super init])) {
+        self.captureCommand = theCommand;
+        self.duration = theDuration;
+        self.callbackId = theCallbackId;
+        self.errorCode = CAPTURE_NO_MEDIA_FILES;
+        self.isTimed = self.duration != nil;
+
+        return self;
+    }
+
+    return nil;
+}
+
+- (void)loadView
+{
+    // create view and display
+    CGRect viewRect = [[UIScreen mainScreen] applicationFrame];
+    UIView* tmp = [[UIView alloc] initWithFrame:viewRect];
+
+    // make backgrounds
+    NSString* microphoneResource = @"Capture.bundle/microphone";
+
+    if (CDV_IsIPhone5()) {
+        microphoneResource = @"Capture.bundle/microphone-568h";
+    }
+
+    UIImage* microphone = [UIImage imageNamed:[self resolveImageResource:microphoneResource]];
+    UIView* microphoneView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewRect.size.width, microphone.size.height)];
+    [microphoneView setBackgroundColor:[UIColor colorWithPatternImage:microphone]];
+    [microphoneView setUserInteractionEnabled:NO];
+    [microphoneView setIsAccessibilityElement:NO];
+    [tmp addSubview:microphoneView];
+
+    // add bottom bar view
+    UIImage* grayBkg = [UIImage imageNamed:[self resolveImageResource:@"Capture.bundle/controls_bg"]];
+    UIView* controls = [[UIView alloc] initWithFrame:CGRectMake(0, microphone.size.height, viewRect.size.width, grayBkg.size.height)];
+    [controls setBackgroundColor:[UIColor colorWithPatternImage:grayBkg]];
+    [controls setUserInteractionEnabled:NO];
+    [controls setIsAccessibilityElement:NO];
+    [tmp addSubview:controls];
+
+    // make red recording background view
+    UIImage* recordingBkg = [UIImage imageNamed:[self resolveImageResource:@"Capture.bundle/recording_bg"]];
+    UIColor* background = [UIColor colorWithPatternImage:recordingBkg];
+    self.recordingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewRect.size.width, recordingBkg.size.height)];
+    [self.recordingView setBackgroundColor:background];
+    [self.recordingView setHidden:YES];
+    [self.recordingView setUserInteractionEnabled:NO];
+    [self.recordingView setIsAccessibilityElement:NO];
+    [tmp addSubview:self.recordingView];
+
+    // add label
+    self.timerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, viewRect.size.width, recordingBkg.size.height)];
+    // timerLabel.autoresizingMask = reSizeMask;
+    [self.timerLabel setBackgroundColor:[UIColor clearColor]];
+    [self.timerLabel setTextColor:[UIColor whiteColor]];
+    [self.timerLabel setTextAlignment:UITextAlignmentCenter];
+    [self.timerLabel setText:@"0:00"];
+    [self.timerLabel setAccessibilityHint:NSLocalizedString(@"recorded time in minutes and seconds", nil)];
+    self.timerLabel.accessibilityTraits |= UIAccessibilityTraitUpdatesFrequently;
+    self.timerLabel.accessibilityTraits &= ~UIAccessibilityTraitStaticText;
+    [tmp addSubview:self.timerLabel];
+
+    // Add record button
+
+    self.recordImage = [UIImage imageNamed:[self resolveImageResource:@"Capture.bundle/record_button"]];
+    self.stopRecordImage = [UIImage imageNamed:[self resolveImageResource:@"Capture.bundle/stop_button"]];
+    self.recordButton.accessibilityTraits |= [self accessibilityTraits];
+    self.recordButton = [[UIButton alloc] initWithFrame:CGRectMake((viewRect.size.width - recordImage.size.width) / 2, (microphone.size.height + (grayBkg.size.height - recordImage.size.height) / 2), recordImage.size.width, recordImage.size.height)];
+    [self.recordButton setAccessibilityLabel:NSLocalizedString(@"toggle audio recording", nil)];
+    [self.recordButton setImage:recordImage forState:UIControlStateNormal];
+    [self.recordButton addTarget:self action:@selector(processButton:) forControlEvents:UIControlEventTouchUpInside];
+    [tmp addSubview:recordButton];
+
+    // make and add done button to navigation bar
+    self.doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissAudioView:)];
+    [self.doneButton setStyle:UIBarButtonItemStyleDone];
+    self.navigationItem.rightBarButtonItem = self.doneButton;
+
+    [self setView:tmp];
+}
+
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil);
+    NSError* error = nil;
+
+    if (self.avSession == nil) {
+        // create audio session
+        self.avSession = [AVAudioSession sharedInstance];
+        if (error) {
+            // return error if can't create recording audio session
+            NSLog(@"error creating audio session: %@", [[error userInfo] description]);
+            self.errorCode = CAPTURE_INTERNAL_ERR;
+            [self dismissAudioView:nil];
+        }
+    }
+
+    // create file to record to in temporary dir
+
+    NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];   // use file system temporary directory
+    NSError* err = nil;
+    NSFileManager* fileMgr = [[NSFileManager alloc] init];
+
+    // generate unique file name
+    NSString* filePath;
+    int i = 1;
+    do {
+        filePath = [NSString stringWithFormat:@"%@/audio_%03d.wav", docsPath, i++];
+    } while ([fileMgr fileExistsAtPath:filePath]);
+
+    NSURL* fileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];
+
+    // create AVAudioPlayer
+    self.avRecorder = [[AVAudioRecorder alloc] initWithURL:fileURL settings:nil error:&err];
+    if (err) {
+        NSLog(@"Failed to initialize AVAudioRecorder: %@\n", [err localizedDescription]);
+        self.avRecorder = nil;
+        // return error
+        self.errorCode = CAPTURE_INTERNAL_ERR;
+        [self dismissAudioView:nil];
+    } else {
+        self.avRecorder.delegate = self;
+        [self.avRecorder prepareToRecord];
+        self.recordButton.enabled = YES;
+        self.doneButton.enabled = YES;
+    }
+}
+
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000
+    - (NSUInteger)supportedInterfaceOrientations
+    {
+        NSUInteger orientation = UIInterfaceOrientationMaskPortrait; // must support portrait
+        NSUInteger supported = [captureCommand.viewController supportedInterfaceOrientations];
+
+        orientation = orientation | (supported & UIInterfaceOrientationMaskPortraitUpsideDown);
+        return orientation;
+    }
+#endif
+
+- (void)viewDidUnload
+{
+    [self setView:nil];
+    [self.captureCommand setInUse:NO];
+}
+
+- (void)processButton:(id)sender
+{
+    if (self.avRecorder.recording) {
+        // stop recording
+        [self.avRecorder stop];
+        self.isTimed = NO;  // recording was stopped via button so reset isTimed
+        // view cleanup will occur in audioRecordingDidFinishRecording
+    } else {
+        // begin recording
+        [self.recordButton setImage:stopRecordImage forState:UIControlStateNormal];
+        self.recordButton.accessibilityTraits &= ~[self accessibilityTraits];
+        [self.recordingView setHidden:NO];
+        NSError* error = nil;
+        [self.avSession setCategory:AVAudioSessionCategoryRecord error:&error];
+        [self.avSession setActive:YES error:&error];
+        if (error) {
+            // can't continue without active audio session
+            self.errorCode = CAPTURE_INTERNAL_ERR;
+            [self dismissAudioView:nil];
+        } else {
+            if (self.duration) {
+                self.isTimed = true;
+                [self.avRecorder recordForDuration:[duration doubleValue]];
+            } else {
+                [self.avRecorder record];
+            }
+            [self.timerLabel setText:@"0.00"];
+            self.timer = [NSTimer scheduledTimerWithTimeInterval:0.5f target:self selector:@selector(updateTime) userInfo:nil repeats:YES];
+            self.doneButton.enabled = NO;
+        }
+        UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
+    }
+}
+
+/*
+ * helper method to clean up when stop recording
+ */
+- (void)stopRecordingCleanup
+{
+    if (self.avRecorder.recording) {
+        [self.avRecorder stop];
+    }
+    [self.recordButton setImage:recordImage forState:UIControlStateNormal];
+    self.recordButton.accessibilityTraits |= [self accessibilityTraits];
+    [self.recordingView setHidden:YES];
+    self.doneButton.enabled = YES;
+    if (self.avSession) {
+        // deactivate session so sounds can come through
+        [self.avSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
+        [self.avSession setActive:NO error:nil];
+    }
+    if (self.duration && self.isTimed) {
+        // VoiceOver announcement so user knows timed recording has finished
+        BOOL isUIAccessibilityAnnouncementNotification = (&UIAccessibilityAnnouncementNotification != NULL);
+        if (isUIAccessibilityAnnouncementNotification) {
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 500ull * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
+                    UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, NSLocalizedString(@"timed recording complete", nil));
+                });
+        }
+    } else {
+        // issue a layout notification change so that VO will reannounce the button label when recording completes
+        UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
+    }
+}
+
+- (void)dismissAudioView:(id)sender
+{
+    // called when done button pressed or when error condition to do cleanup and remove view
+    if ([self.captureCommand.viewController.modalViewController respondsToSelector:@selector(presentingViewController)]) {
+        [[self.captureCommand.viewController.modalViewController presentingViewController] dismissModalViewControllerAnimated:YES];
+    } else {
+        [[self.captureCommand.viewController.modalViewController parentViewController] dismissModalViewControllerAnimated:YES];
+    }
+
+    if (!self.pluginResult) {
+        // return error
+        self.pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:self.errorCode];
+    }
+
+    self.avRecorder = nil;
+    [self.avSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
+    [self.avSession setActive:NO error:nil];
+    [self.captureCommand setInUse:NO];
+    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil);
+    // return result
+    [self.captureCommand.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
+}
+
+- (void)updateTime
+{
+    // update the label with the elapsed time
+    [self.timerLabel setText:[self formatTime:self.avRecorder.currentTime]];
+}
+
+- (NSString*)formatTime:(int)interval
+{
+    // is this format universal?
+    int secs = interval % 60;
+    int min = interval / 60;
+
+    if (interval < 60) {
+        return [NSString stringWithFormat:@"0:%02d", interval];
+    } else {
+        return [NSString stringWithFormat:@"%d:%02d", min, secs];
+    }
+}
+
+- (void)audioRecorderDidFinishRecording:(AVAudioRecorder*)recorder successfully:(BOOL)flag
+{
+    // may be called when timed audio finishes - need to stop time and reset buttons
+    [self.timer invalidate];
+    [self stopRecordingCleanup];
+
+    // generate success result
+    if (flag) {
+        NSString* filePath = [avRecorder.url path];
+        // NSLog(@"filePath: %@", filePath);
+        NSDictionary* fileDict = [captureCommand getMediaDictionaryFromPath:filePath ofType:@"audio/wav"];
+        NSArray* fileArray = [NSArray arrayWithObject:fileDict];
+
+        self.pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:fileArray];
+    } else {
+        self.pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageToErrorObject:CAPTURE_INTERNAL_ERR];
+    }
+}
+
+- (void)audioRecorderEncodeErrorDidOccur:(AVAudioRecorder*)recorder error:(NSError*)error
+{
+    [self.timer invalidate];
+    [self stopRecordingCleanup];
+
+    NSLog(@"error recording audio");
+    self.pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageToErrorObject:CAPTURE_INTERNAL_ERR];
+    [self dismissAudioView:nil];
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/95562e02/src/ios/CDVFile.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVFile.h b/src/ios/CDVFile.h
new file mode 100644
index 0000000..eaf8cbe
--- /dev/null
+++ b/src/ios/CDVFile.h
@@ -0,0 +1,106 @@
+/*
+ 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
+
+ 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.
+ */
+
+#import <Foundation/Foundation.h>
+#import "CDVPlugin.h"
+
+enum CDVFileError {
+    NO_ERROR = 0,
+    NOT_FOUND_ERR = 1,
+    SECURITY_ERR = 2,
+    ABORT_ERR = 3,
+    NOT_READABLE_ERR = 4,
+    ENCODING_ERR = 5,
+    NO_MODIFICATION_ALLOWED_ERR = 6,
+    INVALID_STATE_ERR = 7,
+    SYNTAX_ERR = 8,
+    INVALID_MODIFICATION_ERR = 9,
+    QUOTA_EXCEEDED_ERR = 10,
+    TYPE_MISMATCH_ERR = 11,
+    PATH_EXISTS_ERR = 12
+};
+typedef int CDVFileError;
+
+enum CDVFileSystemType {
+    TEMPORARY = 0,
+    PERSISTENT = 1
+};
+typedef int CDVFileSystemType;
+
+extern NSString* const kCDVAssetsLibraryPrefix;
+
+@interface CDVFile : CDVPlugin {
+    NSString* appDocsPath;
+    NSString* appLibraryPath;
+    NSString* appTempPath;
+    NSString* persistentPath;
+    NSString* temporaryPath;
+
+    BOOL userHasAllowed;
+}
+- (NSNumber*)checkFreeDiskSpace:(NSString*)appPath;
+- (NSString*)getAppPath:(NSString*)pathFragment;
+// -(NSString*) getFullPath: (NSString*)pathFragment;
+- (void)requestFileSystem:(CDVInvokedUrlCommand*)command;
+- (NSDictionary*)getDirectoryEntry:(NSString*)fullPath isDirectory:(BOOL)isDir;
+- (void)resolveLocalFileSystemURI:(CDVInvokedUrlCommand*)command;
+- (void)getDirectory:(CDVInvokedUrlCommand*)command;
+- (void)getFile:(CDVInvokedUrlCommand*)command;
+- (void)getParent:(CDVInvokedUrlCommand*)command;
+- (void)getMetadata:(CDVInvokedUrlCommand*)command;
+- (void)removeRecursively:(CDVInvokedUrlCommand*)command;
+- (void)remove:(CDVInvokedUrlCommand*)command;
+- (CDVPluginResult*)doRemove:(NSString*)fullPath;
+- (void)copyTo:(CDVInvokedUrlCommand*)command;
+- (void)moveTo:(CDVInvokedUrlCommand*)command;
+- (BOOL)canCopyMoveSrc:(NSString*)src ToDestination:(NSString*)dest;
+- (void)doCopyMove:(CDVInvokedUrlCommand*)command isCopy:(BOOL)bCopy;
+// - (void) toURI:(CDVInvokedUrlCommand*)command;
+- (void)getFileMetadata:(CDVInvokedUrlCommand*)command;
+- (void)readEntries:(CDVInvokedUrlCommand*)command;
+
+- (void)readAsText:(CDVInvokedUrlCommand*)command;
+- (void)readAsDataURL:(CDVInvokedUrlCommand*)command;
+- (void)readAsArrayBuffer:(CDVInvokedUrlCommand*)command;
+- (NSString*)getMimeTypeFromPath:(NSString*)fullPath;
+- (void)write:(CDVInvokedUrlCommand*)command;
+- (void)testFileExists:(CDVInvokedUrlCommand*)command;
+- (void)testDirectoryExists:(CDVInvokedUrlCommand*)command;
+// - (void) createDirectory:(CDVInvokedUrlCommand*)command;
+// - (void) deleteDirectory:(CDVInvokedUrlCommand*)command;
+// - (void) deleteFile:(CDVInvokedUrlCommand*)command;
+- (void)getFreeDiskSpace:(CDVInvokedUrlCommand*)command;
+- (void)truncate:(CDVInvokedUrlCommand*)command;
+
+// - (BOOL) fileExists:(NSString*)fileName;
+// - (BOOL) directoryExists:(NSString*)dirName;
+- (void)writeToFile:(NSString*)fileName withData:(NSString*)data append:(BOOL)shouldAppend callback:(NSString*)callbackId;
+- (unsigned long long)truncateFile:(NSString*)filePath atPosition:(unsigned long long)pos;
+
+@property (nonatomic, strong) NSString* appDocsPath;
+@property (nonatomic, strong) NSString* appLibraryPath;
+@property (nonatomic, strong) NSString* appTempPath;
+@property (nonatomic, strong) NSString* persistentPath;
+@property (nonatomic, strong) NSString* temporaryPath;
+@property BOOL userHasAllowed;
+
+@end
+
+#define kW3FileTemporary @"temporary"
+#define kW3FilePersistent @"persistent"

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/95562e02/src/ios/CDVJSON.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVJSON.h b/src/ios/CDVJSON.h
new file mode 100644
index 0000000..eaa895e
--- /dev/null
+++ b/src/ios/CDVJSON.h
@@ -0,0 +1,30 @@
+/*
+ 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
+
+ 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.
+ */
+
+@interface NSArray (CDVJSONSerializing)
+- (NSString*)JSONString;
+@end
+
+@interface NSDictionary (CDVJSONSerializing)
+- (NSString*)JSONString;
+@end
+
+@interface NSString (CDVJSONSerializing)
+- (id)JSONObject;
+@end