I’m having a pig of a time creating a basic video capture feature in my application. I want to call the default video capture tool my device and had the file saved to a specific location.
From the documentation this is achieved by providing a Uri in EXTRA_OUTPUT, however what’s happening is this is completely being ignored and the video is actually being written to the usual media store location.
My code is very simple :
Intent i = new Intent( android.provider.MediaStore.ACTION_VIDEO_CAPTURE );
String SD_CARD_TEMP = Environment.getExternalStorageDirectory()
+ File.separator + MEDIA_TEMP ;
i.putExtra( android.provider.MediaStore.EXTRA_OUTPUT, Uri.parse(SD_CARD_TEMP) );
startActivityForResult( i, ACTIVITY_CAPTURE_VIDEO );
The constant MEDIA_TEMP is set to ‘media_temp’. I’ve also tried using a File rather than a string and using Uri.fromFile() but that made no difference.
If anyone has any ideas as to why this code isn’t behaving as the docs say it should.. please tell me 🙂
PS. Development is being carried out live on HTC Desire HD, not emulator..
Thanks,
Dave
I have the same problem. It works on stock Android, but does not work on HTC or SonyEricsson devices.
Seems as if their cam-app behaves differently to the default.
I think the only possibility would be to ask the media provider for the latest recorded video and get the path from it. Then copy the file to your own directory and delete it from media provider.
Not very smart and error prone, but maybe the only way.
Does someone have a better idea?