File size using RecordControl.setRecordSizeLimit(Integer.MAX VALUE) not set accordingly in Series 40 (Known Issue)
Article Metadata
Code Example
Tested with
Series 40 3rd Edition, FP1
Series 40 5th Edition
Compatibility
Series 40 3rd Edition, FP1
Series 40 5th Edition
Article
Contents |
Overview
File size is not set to the maximum size available in Series 40 when using RecordControl.setRecordSizeLimit(Integer.MAX_VALUE).
Description
When using RecordControl.setRecordSizeLimit(Integer.MAX_VALUE), the file size of the recorded video should be set to its maximum, enabling video recording longer than one minute. However, in Series 40 devices prior to Series 40 5th Edition, Feature Pack 1, the MMAPI player records only for a couple of seconds and exists then abruptly when the value Integer.MAX_VALUE is used.
How to reproduce
1. To reproduce this issue, implement the source code available at: File:Video recorder file size test MIDlet using MMAPI.zip
2. Install and launch the MIDlet in the test device. The MIDlet starts to record video and stops recording within a couple of seconds.
Solution
For the affected devices, the workaround is as follows:
1. Modify the example MIDlet's source code by removing the following lines:
/***Replace part***/
rc.setRecordSizeLimit(Integer.MAX_VALUE);
vid.start();
rc.startRecord();
/***Replace part***/
Replace the removed lines with these lines:
int size = (int) fc.availableSize();
if(size < 100*1024) // if less than 100Kb available
{
Alert memoryAlert = new Alert("Error", "Not enough memory", null, AlertType.ERROR);
memoryAlert.setTimeout(2000);
Display.getDisplay(this).setCurrent(memoryAlert);
}
else{
rc.setRecordSizeLimit(size - 100*1024); /* set the record size limit
based on the free memory in the video folder, leave 100Kb available to the system */
vid.start();
rc.startRecord();
}
2. Install and launch the MIDlet using a test device. The MIDlet starts to record video and stops when it reaches the file size defined in the previous step.


(no comments yet)