MediaRecorder MediaRecorder Class


Used to record audio and video.

[Android.Runtime.Register("android/media/MediaRecorder", ApiSince=1, DoNotGenerateAcw=true)]
public class MediaRecorder : Java.Lang.Object
type MediaRecorder = class
    inherit Object


Android platform documentation

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.


MediaRecorder() MediaRecorder()

Default constructor.

MediaRecorder(IntPtr, JniHandleOwnership) MediaRecorder(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.


MediaErrorServerDied MediaErrorServerDied

Media server died.

MediaRecorderErrorUnknown MediaRecorderErrorUnknown

Unspecified media recorder error.


AudioSourceMax AudioSourceMax

Gets the maximum value for audio sources.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
MaxAmplitude MaxAmplitude

Returns the maximum absolute amplitude that was sampled since the last call to this method.

Metrics Metrics
PeerReference PeerReference Inherited from Object
Surface Surface

Gets the surface to record from when using SURFACE video source.

ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.


Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
Pause() Pause()
Prepare() Prepare()

Prepares the recorder to begin capturing and encoding data.

Release() Release()

Releases resources associated with this MediaRecorder object.

Reset() Reset()

Restarts the MediaRecorder to its idle state.

Resume() Resume()
SetAudioChannels(Int32) SetAudioChannels(Int32)

Sets the number of audio channels for recording.

SetAudioEncoder(AudioEncoder) SetAudioEncoder(AudioEncoder)

Sets the audio encoder to be used for recording.

SetAudioEncodingBitRate(Int32) SetAudioEncodingBitRate(Int32)

Sets the audio encoding bit rate for recording.

SetAudioSamplingRate(Int32) SetAudioSamplingRate(Int32)

Sets the audio sampling rate for recording.

SetAudioSource(AudioSource) SetAudioSource(AudioSource)

Sets the audio source to be used for recording.

SetAuxiliaryOutputFile(FileDescriptor) SetAuxiliaryOutputFile(FileDescriptor)
SetAuxiliaryOutputFile(String) SetAuxiliaryOutputFile(String)
SetCamera(Camera) SetCamera(Camera)

Sets a Camera to use for recording.

SetCaptureRate(Double) SetCaptureRate(Double)

Set video frame capture rate.

SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetInputSurface(Surface) SetInputSurface(Surface)
SetLocation(Single, Single) SetLocation(Single, Single)

Set and store the geodata (latitude and longitude) in the output file.

SetMaxDuration(Int32) SetMaxDuration(Int32)

Sets the maximum duration (in ms) of the recording session.

SetMaxFileSize(Int64) SetMaxFileSize(Int64)

Sets the maximum filesize (in bytes) of the recording session.

SetNextOutputFile(File) SetNextOutputFile(File)
SetNextOutputFile(FileDescriptor) SetNextOutputFile(FileDescriptor)
SetOnErrorListener(MediaRecorder+IOnErrorListener) SetOnErrorListener(MediaRecorder+IOnErrorListener)

Register a callback to be invoked when an error occurs while recording.

SetOnInfoListener(MediaRecorder+IOnInfoListener) SetOnInfoListener(MediaRecorder+IOnInfoListener)

Register a callback to be invoked when an informational event occurs while recording.

SetOrientationHint(Int32) SetOrientationHint(Int32)

Sets the orientation hint for output video playback.

SetOutputFile(File) SetOutputFile(File)
SetOutputFile(FileDescriptor) SetOutputFile(FileDescriptor)

Pass in the file descriptor of the file to be written.

SetOutputFile(String) SetOutputFile(String)

Sets the path of the output file to be produced.

SetOutputFormat(OutputFormat) SetOutputFormat(OutputFormat)

Sets the format of the output file produced during recording.

SetPreviewDisplay(Surface) SetPreviewDisplay(Surface)

Sets a Surface to show a preview of recorded media (video).

SetProfile(CamcorderProfile) SetProfile(CamcorderProfile)

Uses the settings from a CamcorderProfile object for recording.

SetVideoEncoder(VideoEncoder) SetVideoEncoder(VideoEncoder)

Sets the video encoder to be used for recording.

SetVideoEncodingBitRate(Int32) SetVideoEncodingBitRate(Int32)

Sets the video encoding bit rate for recording.

SetVideoEncodingProfileLevel(MediaCodecProfileType, Int32) SetVideoEncodingProfileLevel(MediaCodecProfileType, Int32)
SetVideoFrameRate(Int32) SetVideoFrameRate(Int32)

Sets the frame rate of the video to be captured.

SetVideoSize(Int32, Int32) SetVideoSize(Int32, Int32)

Sets the width and height of the video to be captured.

SetVideoSource(VideoSource) SetVideoSource(VideoSource)

Sets the video source to be used for recording.

Start() Start()

Begins capturing and encoding data to the file specified with setOutputFile().

Stop() Stop()

Stops recording.

ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)


Error Error
Info Info

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to