views:

126

answers:

3

Android - What is the maximum file size that setMaxFileSize can be set to in respect to Androids mediarecorder? I know it's somewhere between 4147483650 and 5147483650. Why is there a limit in the first place?

I'm recording on to a SDCARD, detecting the size of the cards space before we run.

"ERROR/AuthorDriver(31): setParameter(max-filesize = 7270309850) failed with result -5" "ERROR/AuthorDriver(31): Ln 903 handleSetParameters("max-filesize=7270309850") error" "ERROR/AndroidRuntime(409): java.lang.RuntimeException: setMaxFileSize failed."

+1  A: 

OK, I know know that the maximum, after trial and error with a little reasoning is:- 4294967295 (4 Gb).

Does anyone know a way around this limit?

andy_spoo
Never answer your own question on StackOverflow unless you are providing a real answer. If you want to provide additional information on your question, edit the question.
CommonsWare
+1  A: 

Why is there a limit in the first place?

SD cards use the msdos (FAT16) filesystem, which has a file size limit. This is not an Android limitation, but a limitation of SD cards in general.

CommonsWare
Thanks for the reply. Nice to know MS's legacy still bites...arrrgh!!
andy_spoo
A: 

I'm working on an android recorder as well.

use StatFs and pass the path of the external storage directory to the constructor and you can call functions such as getAvailableBlocks() and getBlockSize() on the StatFs object.

So that way you know how much more space is available on the SD card.

Namratha
Ah yes, that was what I used. That part of it worked, it's just that when I create a file over the 4Gb, I got the problem above. If your recording to an 2Gb SD-card for example, you'll never see the limitations above. You could create 2 x 4Gb files and play one after another, with a tiny gap between.
andy_spoo