From 0c1ec7e8cd43de1a4b4cb650b759dd0cbe123eaa Mon Sep 17 00:00:00 2001 From: Wu-cheng Li Date: Thu, 20 Oct 2011 12:07:00 +0800 Subject: Fix the resolver activity shows the apps that cannot play the video. Camcorder apps needs to set the mime type to play the captured video in video capture intent mode. bug:5471592 Change-Id: I104baa4ff789fa8bb3136254105bc7284f391723 --- src/com/android/camera/VideoCamera.java | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 7ea8542..d3109ea 100755 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -565,7 +565,8 @@ public class VideoCamera extends ActivityBase } private void startPlayVideoActivity() { - Intent intent = new Intent(Intent.ACTION_VIEW, mCurrentVideoUri); + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(mCurrentVideoUri, convertOutputFormatToMimeType(mProfile.fileFormat)); try { startActivity(intent); } catch (ActivityNotFoundException ex) { @@ -1350,12 +1351,9 @@ public class VideoCamera extends ActivityBase private void generateVideoFilename(int outputFileFormat) { long dateTaken = System.currentTimeMillis(); String title = createName(dateTaken); - String filename = title + ".3gp"; // Used when emailing. - String mime = "video/3gpp"; - if (outputFileFormat == MediaRecorder.OutputFormat.MPEG_4) { - filename = title + ".mp4"; - mime = "video/mp4"; - } + // Used when emailing. + String filename = title + convertOutputFormatToFileExt(outputFileFormat); + String mime = convertOutputFormatToMimeType(outputFileFormat); mVideoFilename = Storage.DIRECTORY + '/' + filename; mCurrentVideoValues = new ContentValues(7); mCurrentVideoValues.put(Video.Media.TITLE, title); @@ -2362,4 +2360,18 @@ public class VideoCamera extends ActivityBase mResetEffect = true; return false; } + + private String convertOutputFormatToMimeType(int outputFileFormat) { + if (outputFileFormat == MediaRecorder.OutputFormat.MPEG_4) { + return "video/mp4"; + } + return "video/3gpp"; + } + + private String convertOutputFormatToFileExt(int outputFileFormat) { + if (outputFileFormat == MediaRecorder.OutputFormat.MPEG_4) { + return ".mp4"; + } + return ".3gp"; + } } -- cgit v1.1