Stable way to set Max duration for MediaStore.ACTION_VIDEO_CAPTURE

大兔子大兔子 提交于 2019-12-10 13:45:30

问题


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.


回答1:


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);



回答2:


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.



来源:https://stackoverflow.com/questions/7875577/stable-way-to-set-max-duration-for-mediastore-action-video-capture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!