Skip to content
Permalink
Browse files
CB-10489 Fix for MediaFile.getFormatData / audio recording support
This closes #53
  • Loading branch information
tbutcaru authored and vladimir-kotikov committed Oct 26, 2016
1 parent ab8b633 commit 26f9ad109552f86f0052a1ca325a03bb07db3d16
Showing 1 changed file with 4 additions and 2 deletions.
@@ -25,6 +25,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;

import android.os.Build;
import android.os.Bundle;
@@ -61,6 +62,7 @@ public class Capture extends CordovaPlugin {
private static final String VIDEO_3GPP = "video/3gpp";
private static final String VIDEO_MP4 = "video/mp4";
private static final String AUDIO_3GPP = "audio/3gpp";
private static final String[] AUDIO_TYPES = new String[] {"audio/3gpp", "audio/aac", "audio/amr", "audio/wav"};
private static final String IMAGE_JPEG = "image/jpeg";

private static final int CAPTURE_AUDIO = 0; // Constant for capture audio
@@ -169,7 +171,7 @@ private JSONObject getFormatData(String filePath, String mimeType) throws JSONEx
if (mimeType.equals(IMAGE_JPEG) || filePath.endsWith(".jpg")) {
obj = getImageData(fileUrl, obj);
}
else if (mimeType.endsWith(AUDIO_3GPP)) {
else if (Arrays.asList(AUDIO_TYPES).contains(mimeType)) {
obj = getAudioVideoData(filePath, obj, false);
}
else if (mimeType.equals(VIDEO_3GPP) || mimeType.equals(VIDEO_MP4)) {
@@ -454,7 +456,7 @@ private JSONObject createMediaFile(Uri data) {
try {
// File properties
obj.put("name", fp.getName());
obj.put("fullPath", fp.toURI().toString());
obj.put("fullPath", Uri.fromFile(fp));
if (url != null) {
obj.put("localURL", url.toString());
}

0 comments on commit 26f9ad1

Please sign in to comment.