MediaRecorder class

Used to record audio and video.

For a more detailed explanation: https://developer.android.com/reference/android/media/MediaRecorder

Annotations
  • @Reference('android_media/media_recorder/MediaRecorder')

Constructors

MediaRecorder({@ignoreParam bool create = true})
Default constructor for MediaRecorder.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getMaxAmplitude() Future<int>
Returns the maximum absolute amplitude that was sampled since the last call to this method.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() Future<void>
Pauses recording.
prepare() Future<void>
Prepares the recorder to begin capturing and encoding data.
release() Future<void>
Releases resources associated with this MediaRecorder object.
reset() Future<void>
Restarts the MediaRecorder to its idle state.
resume() Future<void>
Resumes recording.
setAudioChannels(int numChannels) Future<void>
Sets the number of audio channels for recording.
setAudioEncoder(int encoder) Future<void>
Sets the audio encoder to be used for recording.
setAudioEncodingBitRate(int bitRate) Future<void>
Sets the audio encoding bit rate for recording in bits per second.
setAudioSamplingRate(int samplingRate) Future<void>
Sets the audio sampling rate for recording in samples per second.
setAudioSource(int source) Future<void>
Sets the audio source to be used for recording.
setCamera(Camera camera) Future<void>
Sets a Camera to use for recording.
setCaptureRate(double fps) Future<void>
Set video frame capture rate.
setLocation(double latitude, double longitude) Future<void>
Set and store the geodata (latitude and longitude) in the output file.
setMaxDuration(int maxDurationMs) Future<void>
Sets the maximum duration (in ms) of the recording session.
setMaxFileSize(int maxFilesizeBytes) Future<void>
Sets the maximum filesize (in bytes) of the recording session.
setNextOutputFilePath(String path) Future<void>
Sets the next output file to be used when the maximum filesize is reached on the prior output setOutputFilePath or setNextOutputFilePath.
setOnErrorListener({required OnErrorListener onError}) Future<void>
Register a callback to be invoked when an error occurs while recording.
setOnInfoListener({required OnInfoListener onInfo}) Future<void>
Register a callback to be invoked when an informational event occurs while recording.
setOrientationHint(int degrees) Future<void>
Sets the orientation hint for output video playback.
setOutputFilePath(String path) Future<void>
Sets the path of the output file to be produced.
setOutputFormat(int format) Future<void>
Sets the format of the output file produced during recording. Call this after setAudioSource/setVideoSource but before prepare.
setProfile(CamcorderProfile profile) Future<void>
Uses the settings from a CamcorderProfile object for recording.
setVideoEncoder(int encoder) Future<void>
Sets the video encoder to be used for recording.
setVideoEncodingBitRate(int bitRate) Future<void>
Sets the video encoding bit rate for recording in bits per seconds.
setVideoFrameRate(int rate) Future<void>
Sets the frame rate of the video to be captured in frames per second.
setVideoSize(int width, int height) Future<void>
Sets the width and height of the video to be captured.
setVideoSource(int source) Future<void>
Sets the video source to be used for recording.
start() Future<void>
Begins capturing and encoding data to the file specified with setOutputFilePath.
stop() Future<void>
Stops recording.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getAudioSourceMax() Future<int>
Gets the maximum value for audio sources.

Constants

errorServerDied → const int
Media server died.
errorUnknown → const int
Unspecified media recorder error.
infoMaxDurationReached → const int
A maximum duration had been setup and has now been reached.
infoMaxFilesizeApproaching → const int
A maximum filesize had been setup and current recorded file size has reached 90% of the limit.
infoMaxFilesizeReached → const int
A maximum filesize had been setup and has now been reached.
infoNextOutputFileStarted → const int
A maximum filesize had been reached and MediaRecorder has switched output to a new file set by application setNextOutputFilePath.
infoUnknown → const int
Unspecified media recorder info.