You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/12/09 21:07:26 UTC
git commit: CB-5517 Fix the audio capture IO exception by putting it
in a runnable
Updated Branches:
refs/heads/dev 09d74febd -> 7184efe7a
CB-5517 Fix the audio capture IO exception by putting it in a runnable
https://github.com/apache/cordova-plugin-media-capture/pull/10
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/7184efe7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/tree/7184efe7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/diff/7184efe7
Branch: refs/heads/dev
Commit: 7184efe7a00b13ca4b10938932a2092009818103
Parents: 09d74fe
Author: Jeff Sawatzky <je...@scribblelive.com>
Authored: Mon Dec 9 13:59:45 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Dec 9 15:05:48 2013 -0500
----------------------------------------------------------------------
src/android/Capture.java | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/7184efe7/src/android/Capture.java
----------------------------------------------------------------------
diff --git a/src/android/Capture.java b/src/android/Capture.java
index 9cfa9b9..2318a06 100644
--- a/src/android/Capture.java
+++ b/src/android/Capture.java
@@ -259,18 +259,27 @@ public class Capture extends CordovaPlugin {
if (resultCode == Activity.RESULT_OK) {
// An audio clip was requested
if (requestCode == CAPTURE_AUDIO) {
- // Get the uri of the audio clip
- Uri data = intent.getData();
- // create a file object from the uri
- results.put(createMediaFile(data));
-
- if (results.length() >= limit) {
- // Send Uri back to JavaScript for listening to audio
- this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, results));
- } else {
- // still need to capture more audio clips
- captureAudio();
- }
+
+ final Capture that = this;
+ Runnable captureAudio = new Runnable() {
+
+ @Override
+ public void run() {
+ // Get the uri of the audio clip
+ Uri data = intent.getData();
+ // create a file object from the uri
+ results.put(createMediaFile(data));
+
+ if (results.length() >= limit) {
+ // Send Uri back to JavaScript for listening to audio
+ that.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, results));
+ } else {
+ // still need to capture more audio clips
+ captureAudio();
+ }
+ }
+ };
+ this.cordova.getThreadPool().execute(captureAudio);
} else if (requestCode == CAPTURE_IMAGE) {
// For some reason if I try to do:
// Uri data = intent.getData();
@@ -331,10 +340,10 @@ public class Capture extends CordovaPlugin {
};
this.cordova.getThreadPool().execute(captureImage);
} else if (requestCode == CAPTURE_VIDEO) {
-
+
final Capture that = this;
Runnable captureVideo = new Runnable() {
-
+
@Override
public void run() {
// Get the uri of the video clip