I use following Intent
s for recording video and taking pictures, but in Motorola Droid 2.2 the camera Intent
save option fails, ie nothing get saved, and the camcoder Intent
cancel crashes my application.
In both Intent
I explicitly passing the file and after it return result "ok" I use the file, ie when user press the save/insert options in the intent: SAVE in camcoder no problem, only cancel casues crash in camcorder.
Camera
Intent intent2 = new Intent("android.media.action.IMAGE_CAPTURE");
imgUri = Uri.fromFile(photofile);
intent2.putExtra(MediaStore.EXTRA_OUTPUT, imgUri);
startActivityForResult(intent2, 1);
Camcoder
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);
NB: The Recorded Video can't be played with HTC ERIS
Camera Permission - Your application must request permission to use a device camera. Note: If you are using the camera by invoking an existing camera app, your application does not need to request this permission. For a list of camera features, see the manifest Features Reference.
For most Android devices, you can find the video recorder under the camera app. Once you're in your camera, scroll along the bottom of your screen to find the Video tab. From here, you can press the record button on your screen to start the video and then press stop to end it.
If you can't avoid using android.provider.MediaStore.EXTRA_OUTPUT
try to prepare URI via content provider like that
context.getContentResolver().insert(android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI, contentValues);
To to so you should prepare correct content values first (setup MediaColumns.DISPLAY_NAME, MediaColumns.MIME_TYPE and so on).
But the best way is just to not specify you own URI and user URI that system will give for your video.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With