Android video recording, camera setup

I use the following Intent for video recording and shooting, but in Motorola Droid 2.2 the option to save the Intent camera does not work, i.e. nothing is saved, and camcoder intent cancel cancel cancels my application.

In both Intent I explicitly pass the file and after it returns the result "ok". I use this file, that is, when the user clicks the save / paste options in the intention: SAVE there are no problems in camcoder, it only cancels the frame failure in the camcorder.

the cameras

  Intent intent2 = new Intent("android.media.action.IMAGE_CAPTURE"); imgUri = Uri.fromFile(photofile); intent2.putExtra(MediaStore.EXTRA_OUTPUT, imgUri); startActivityForResult(intent2, 1); 

Camcorder

  Intent i = new Intent("android.media.action.VIDEO_CAPTURE"); i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(videofile)); i.putExtra(android.provider.MediaStore.EXTRA_VIDEO_QUALITY, 0); i.putExtra("android.intent.extra.durationLimit", 60); startActivityForResult(i, 2); 

Note: recorded video cannot be played using HTC ERIS

+6
android android-intent android-camera
source share
1 answer

If you cannot avoid using android.provider.MediaStore.EXTRA_OUTPUT , try to prepare the URI through a content provider such as

 context.getContentResolver().insert(android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI, contentValues); 

To do this, you must first prepare the correct content values ​​(set MediaColumns.DISPLAY_NAME, MediaColumns.MIME_TYPE, etc.).

But the best way is simply not to specify your own URI and custom URI, which the system will provide for your video.

+1
source share

All Articles