In my application I'm trying to launch the Video with resolution set to minimum.
I'm using the EXTRA_VIDEO_QUALITY intent for that.
Here is the relevant code:
int NEW_VIDEO = 1;
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 600000);
startActivityForResult(intent, NEW_VIDEO);
However, when the video camera starts it is set to the resolution that was previously defined in the device and ignores the EXTRA_VIDEO_QUALITY intent.
Does anybody encountered this issue before?
Thanks,
Yair
HTC Desire behaves same way with videos.
It also ignores uri if you want to define where to save the video. Capturing pictures works perfectly. I guess there is some mishap in Sense UI regarding video capture.
Related
I'm trying to limit the length of a video captured on Google Glass via the follow code:
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 10);
intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 10485760); // 10mb in bytes
startActivityForResult(intent, Constants.TAKE_VIDEO_REQUEST);
It appears Glass ignores these extras though. The user still has the option to tap extend and the file size never stops the video either.
Are these extras used in Glass or is this a bug?
EDIT: Filed a feature request: https://code.google.com/p/google-glass-api/issues/detail?id=469
Those Intent Extras are not actually used by the ACTION_VIDEO_CAPTURE action. Please file a feature request on our issues tracker to track this.
Alain,
this is happening to me as well.
I submitted Issue 651 for that.
I launch video capture intent on Galaxy Camera using below code:
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // With and without this, it yields same resolution
startActivityForResult(intent, 2);
and default video resolution turns out to be 320x240 #30fps. How do I change it to use highest possible video resolution i.e. 1920x1080
How do I change it to use highest possible video resolution i.e. 1920x1080
Use MediaRecorder directly. You cannot force a third-party camera app, whatever that app may be, to record at any particular resolution. While whatever app you are using should record at different resolutions for differing values of EXTRA_VIDEO_QUALITY, there is no requirement that it do so.
I am opening android camera using intent like this :
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
But camera always opens 6mp resolution (i think its devices max camera resolution) i want to open it lower resolution like 2mp. Is there anyway to do this
Thanks for any advice.
Unfortunately there is no way you can do this. Once a different application is lauched the settings of that app can only be changed by the user using the application.
It would be disastrous to allow other apps to change the settings of an app.
So you have two options now -
Build you own camera activity and take pictures in the resolution that you want
Tell the user to take pictures only at the resolution that you specidy, basically ask the user to change the camera resolution to the one you want in the camera application before he takes a picture..
This option is available only for video capturing, using this lines
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // high quality
startActivityForResult()
For our disasapoitment "MediaStore" don`t have parameter for EXTRA_IMAGE_QUALITY
I use
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(getSomePath()+"temp.jpg")));
//intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(intent, 0);
to get a picture and the saved picture returns as full-size.
But I want to get a limited picture, like 800*640, because on different devices I get different sizes, and I don't need that big picture.
I notice that there is a EXTRA_SIZE_LIMIT in MediaStore , but I can't find how to use it, what parameter should be set?
Answering my own question.
Finally I found that's because different manufacturers customize their Rom, including the Camera app, so the best way is not to call the default camera app, instead we can write a activity use hardware.camera to take picture. There are a lot of examples for this around the Internet too.
Unfortunately EXTRA_SIZE_LIMIT used for video limit in bytes.
I made a program whose major function is use API to take photos and store them in the path I gave.
But things don't come out right on different phones comparing to that when I tested on the emulator or phone with Google's origin ROM.
Theoretically. If I gave a path to the Intent, the photo shouldn't appear in the phone's default gallery, but on MOTO Defy the photos were stored in both my path and default image directory. And on Samsung, my app crashes silently when return from the camera Intent. And only on some phones I can bring up menu by pressing the menu button in the Camera Activity. And even some of them saves photo as the size I set in the Camera Activity's setting menu.
I think this is because the manufacturers customized the ROM on their phones so the Camera Activity acts differently.
Anyone know how to avoid this situation? Or is there any other way to take photos not by the intent "android.media.action.IMAGE_CAPTURE" ?
The following is the code how I take photos.
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(getpath()+"_.jpg")));
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(intent, 0);
The way that #balban shah offered worked all the same when I tried.
Finally I found that's because different manufacturers customize their Rom, including the Camera app, so the best way is not to call the default camera app, instead we can write a activity use hardware.camera to take picture. There are a lot of examples for this around the Internet too.
try to use this code keep other setting same for photo capture
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(origImageFile));
startActivityForResult(cameraIntent, 0);