Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stable way to set Max duration for MediaStore.ACTION_VIDEO_CAPTURE

I learned from few post here that MediaStore.EXTRA_DURATION_LIMIT for capturing video, could work only from versions 2.2 ,but i am using Samsung Galaxy S II which is of 2.3.3 version . The below code seems to have no effect for max duration.

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 2000);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
intent.putExtra(MediaStore.EXTRA_FINISH_ON_COMPLETION,true);
startActivityForResult(intent, REQUEST_TAKE_VIDEO);

If its device specific,then is there a workaround for this issue.

like image 393
ganesh Avatar asked Oct 24 '11 12:10

ganesh


2 Answers

The documentation states that EXTRA_DURATION_LIMIT is in seconds.

Setting it to 2000 would be 33 minutes, try 2:

intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 2);
like image 80
ermau Avatar answered Oct 21 '22 02:10

ermau


when you set EXTRA_VIDEO_QUALITY to zero, It is create mms and not works as a video recorder:EXTRA_VIDEO_QUALITY

If you want set value of EXTRA_DURATION_LIMIT, then you have to change EXTRA_VIDEO_QUALITY value to 1.

like image 27
amin Avatar answered Oct 21 '22 02:10

amin