mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
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.
This commit is contained in:
parent
664a061d10
commit
210cc2bd5e
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user