Stable way to set Max duration for MediaStore.ACTI

2019-06-21 05:39发布

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.

2条回答
乱世女痞
2楼-- · 2019-06-21 06:22

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);
查看更多
何必那么认真
3楼-- · 2019-06-21 06:25

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.

查看更多
登录 后发表回答