You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2012/02/03 18:26:17 UTC
git commit: Fixing MediaFileData problem for MP4 video types
Updated Branches:
refs/heads/master 664a061d1 -> 210cc2bd5
Fixing MediaFileData problem for MP4 video types
Problem:
Using Capture Video and mediaFile.getFormatData() on Android:
Droid / 2.2.3: successfully get height, width, duration
Samsung Galaxy Tab 10.1 / 3.1: recording appears to succeed,
however height / width / duration all come back as 0.
Fix:
The Samsung Galaxy Tab 10.1 returns a MP4 video and not 3GPP as was expected in the Capture class.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/210cc2bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/210cc2bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/210cc2bd
Branch: refs/heads/master
Commit: 210cc2bd5e8e0b5ceb360b4c10a46e96fd610ca8
Parents: 664a061
Author: macdonst <si...@gmail.com>
Authored: Fri Feb 3 12:24:41 2012 -0500
Committer: macdonst <si...@gmail.com>
Committed: Fri Feb 3 12:24:45 2012 -0500
----------------------------------------------------------------------
framework/src/org/apache/cordova/Capture.java | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/210cc2bd/framework/src/org/apache/cordova/Capture.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Capture.java b/framework/src/org/apache/cordova/Capture.java
index d2d5b7d..64a76f3 100644
--- a/framework/src/org/apache/cordova/Capture.java
+++ b/framework/src/org/apache/cordova/Capture.java
@@ -42,6 +42,7 @@ import android.util.Log;
public class Capture extends Plugin {
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 IMAGE_JPEG = "image/jpeg";
@@ -128,7 +129,7 @@ public class Capture extends Plugin {
else if (mimeType.endsWith(AUDIO_3GPP)) {
obj = getAudioVideoData(filePath, obj, false);
}
- else if (mimeType.equals(VIDEO_3GPP)) {
+ else if (mimeType.equals(VIDEO_3GPP) || mimeType.equals(VIDEO_MP4)) {
obj = getAudioVideoData(filePath, obj, true);
}
}
@@ -167,7 +168,7 @@ public class Capture extends Plugin {
try {
player.setDataSource(filePath);
player.prepare();
- obj.put("duration", player.getDuration());
+ obj.put("duration", player.getDuration()/1000);
if (video) {
obj.put("height", player.getVideoHeight());
obj.put("width", player.getVideoWidth());