While developing & testing a MIDlet for recording video (and audio) on the new N93 device I found out the following strange behaviour that seems like a real bug in the implementation of the MMAPI on that device:
1) Trying to record a sequence of 5 seconds video clips (each clip in a different file) results with the first file containing video and audio but the rest of the following recorded files are audio only (video stream is zero length) with no video shown although the recording player is video capturing type.
2) Trying to record a sequence of 5 seconds audio clips, resulted with first file containing audio and next file empty followed by an exception of unknown kind (exception.getMessage() is null). NOTICE: Using the same code as video but only changing the player type from capture://video to capture://audio . So Video is working partially but Audio which is an older feature crashes.
3) Recording a single video (+audio) file using the MMAPI is working but when played with the phone player or on a PC it has a sync problem. A delay of 0.5-1.5 seconds between the audio and video (audio starts late and continues after video has ended).
4) Two successive RecordControl.commit() calls (e.g. with no other RecordControl calls) would result in exception and in some cases crash your phone (soft reset?!).
I used the setRecordLocation API call to set a new record file location for each chunk and RecordControl to start/commit recording to the file and cycle this again and again...
Also for some unknown reason had to create the file if it didn't exist or else and exception was thrown, thus, I used FileConnection API.
Here is the simplfied stripped code I have used for the task:
player = Manager.createPlayer("capture://video");
videoControl = (VideoControl)player.getControl("VideoControl");
Item videoItem = (Item)videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
recordControl = (RecordControl)player.getControl("RecordControl");
String movieFilePrefix = System.getProperty("fileconn.dir.memorycard")+ "Videos/capture";
int fileCount = 0;
String file_path = System.getProperty("fileconn.dir.memorycard")+ "Videos/capture" + fileCount + ".3gp";
FileConnection fconn = (FileConnection)Connector.open(file_path, Connector.READ_WRITE);
fconn.create(); // create the file if it doesn't exist
Thread.sleep(5000); // 5 seconds clips
recordControl.commit(); // implicitialy call recordControl.stopRecord();
Any idea anyone?
Can the guys from NOKIA verify it is a bug? is it only on N93?
I do not have access to other devices besides that N93 so I cannot verify if it is a bug on other devices as well...
I am stuck - please help!!!
The only work around I found was to close the whole player and create a new one for each recording chunk - but that is very demanding in CPU time ... (start/stop player is not enough) which affects the recording continuity...
IMHO looks like the MMAPI is not working correctly even in sample code given by NOKIA (see #3 above - video/audio sync issue).
Let me know if more details are needed.