MediaRecorder.SetMaxFileSize(Int64) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the maximum filesize (in bytes) of the recording session.
[Android.Runtime.Register("setMaxFileSize", "(J)V", "GetSetMaxFileSize_JHandler")]
public virtual void SetMaxFileSize (long max_filesize_bytes);
[<Android.Runtime.Register("setMaxFileSize", "(J)V", "GetSetMaxFileSize_JHandler")>]
abstract member SetMaxFileSize : int64 -> unit
override this.SetMaxFileSize : int64 -> unit
Parameters
- max_filesize_bytes
- Int64
the maximum filesize in bytes (if zero or negative, disables the limit)
- Attributes
Exceptions
Remarks
Sets the maximum filesize (in bytes) of the recording session. Call this after setOutputFormat() but before prepare(). After recording reaches the specified filesize, a notification will be sent to the android.media.MediaRecorder.OnInfoListener
with a "what" code of #MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED
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(int)
with OutputFormat#MPEG_4
), it is recommended to set maximum filesize that fits the use case. Setting a larger than required filesize 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.
Java documentation for android.media.MediaRecorder.setMaxFileSize(long)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.