开发者

Android Samsung video EXTRA_SIZE_LIMIT 600K Max MMS

开发者 https://www.devze.com 2023-03-27 05:23 出处:网络
why i can\'t control the size of the video in Samsung GalaxyS, it always record in hi resolution on other devices it work well

why i can't control the size of the video in Samsung GalaxyS, it always record in hi resolution on other devices it work well

code example:

Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); 
                            intent.put开发者_StackOverflow社区Extra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
                            intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, UiConstants.MAX_MMS_SIZE);
                            startActivityForResult(intent, NEW_VIDEO); 
                            overridePendingTransition(0, 0);


This will work...

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT,10); //10 sec
intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT,12582912L); //12*1024*1024=12MiB
startActivityForResult(intent, NEW_VIDEO); 
overridePendingTransition(0, 0);

'L' is important.. It worked in my samsung phones


Android OEMs like Samsung can (and often do) modify the camera app to work with the cameras on their devices.

So, the most likely reason your code is not working is because Samsung's version of the default camera application either does not support low-res video capture, or it doesn't understand/process the MediaStore.EXTRA_SIZE_LIMIT correctly.

I suggest building a compatibility function that checks the final size of the video to de-rez and clip to your MMS size limit.

Edit: Just tried MediaStore.EXTRA_SIZE_LIMIT on a couple of devices (including a Samsung and Motorola OG Droid) and could not get it to work. MediaStore.EXTRA_DURATION_LIMIT worked fine, however.


intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT,"1048576"); //1048576=(1*1024*1024)

I had to pass it as a string to limit image size

0

精彩评论

暂无评论...
验证码 换一张
取 消