How do you capture Video by calling the Android camera app using an intent in 4.3. I had it working in 4.2 and below. Even Google's sample is broken. Is this a bug? Or has Google changed how they return recorded video. Image capture still works.
I still get a RESULT_OK back but the intent data is null on MediaStore.ACTION_VIDEO_CAPTURE intents.
Yes, there is a bug starting with Android 4.3 release.
As the documentation says:
If EXTRA_OUTPUT is not present the video will be written to the standard location for videos, and the Uri of that location will be returned in the data field of the Uri.
What I have experienced is that the returned data field value is Null
instead of containing the video file's Uri
.
For now, is to pass MediaStore.EXTRA_OUTPUT
to the Intent
specifying the output location for the video file if the device's API Version is 18. This works as intended.
Since you were using the default gallery location for storing your videos, my guess is that you will want to keep it the same. So for this you need to set EXTRA_OUTPUT
as follows.
Insert a new record into MediaStore.Video.Media.EXTERNAL_CONTENT_URI:
Uri videoUri = context.getContentResolver().insert(EXTERNAL_CONTENT_URI, value);
Being value
a ContentValues
with display name, file type and file path to the new video file. E.g. :
ContentValues value = new ContentValues();
value.put(MediaStore.Video.Media.TITLE, "VideoTitle");
value.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4");
value.put(MediaStore.Video.Media.DATA, videoFilePath);
Pass the returned value, videoUri
, as the EXTRA_OUPUT
to the Intent
.
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