Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set a maximum time allowed for android recording using intent?

I am using the android.provider.MediaStore.ACTION_VIDEO_CAPTURE. I was wondering if there is a way to change the maximum time allowed per recording. I TRIED ADDING Intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT,60000);//max of 60 seconds but it continues recording pass that. Thanks in advance.

like image 557
user875139 Avatar asked Oct 31 '11 05:10

user875139


2 Answers

Actually, MediaStore.EXTRA_DURATION_LIMIT provide time in seconds, NOT in miliseconds! So you just need to change your value from 60000 to 60 ;) Android Documentation

like image 98
Raul Shwebster Avatar answered Sep 21 '22 03:09

Raul Shwebster


Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); intent.putExtra("android.intent.extra.durationLimit", 30000); intent.putExtra("EXTRA_VIDEO_QUALITY", 0); startActivityForResult(intent, ActivityRequests.REQUEST_TAKE_VIDEO); 

This code works well on API 2.2, but the duration limit does not work on API 2.1

android.intent.extra.durationLimit was introduced in API Level 8, so it's not available in Eclair and earlier, unfortunately. Some device manufacturers may have a proprietary way to set the maximum duration on older devices, which explain why you have seen this working on some pre-Froyo applications.

like image 24
jennifer Avatar answered Sep 18 '22 03:09

jennifer