setMaxDuration method
Sets the maximum duration (in ms) of the recording session.
Call this after setOutputFormat but before prepare. After recording reaches the specified duration, a notification will be sent to the OnInfoListener with a "what" code of infoMaxDurationReached and recording will be stopped. Stopping happens asynchronously, there is no guarantee that the recorder will have stopped by the time the listener is notified.
When using MPEG-4 container (setOutputFormat with OutputFormat.mpeg4), it is recommended to set maximum duration that fits the use case. Setting a larger than required duration may result in a larger than needed output file because of space reserved for MOOV box expecting large movie data in this recording session. Unused space of MOOV box is turned into FREE box in the output file.
Implementation
Future<void> setMaxDuration(int maxDurationMs) {
return _channel.$setMaxDuration(this, maxDurationMs);
}