Android Guides | Samples

Android.Media.MediaActionSound Class

See Also: MediaActionSound


[Android.Runtime.Register("android/media/MediaActionSound", DoNotGenerateAcw=true)]
public class MediaActionSound : Object


A class for producing sounds that match those produced by various actions taken by the media and camera APIs.

This class is recommended for use with the Android.Hardware.Camera2 API, since the camera2 API does not play any sounds on its own for any capture or video recording actions.

With the older Camera API, use this class to play an appropriate camera operation sound when implementing a custom still or video recording mechanism (through the Camera preview callbacks with Android.Hardware.Camera.SetPreviewCallback(.IPreviewCallback), or through GPU processing with Camera.SetPreviewTexture(SurfaceTexture), for example), or when implementing some other camera-like function in your application.

There is no need to play sounds when using Android.Hardware.Camera.TakePicture(.IShutterCallback, .IPictureCallback, .IPictureCallback) or MediaRecorder for still images or video, respectively, as the Android framework will play the appropriate sounds when needed for these calls.

[Android Documentation]


Namespace: Android.Media
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions:
Since: Added in API level 16

The members of Android.Media.MediaActionSound are listed below.

See Also: Object

Public Constructors

Construct a new MediaActionSound instance.

Protected Constructors

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

Public Fields

FocusCompleteMediaActionSoundType (1). A sound to indicate that focusing has completed.
ShutterClickMediaActionSoundType (0). The sound used by Android.Hardware.Camera.TakePicture(.IShutterCallback, .IPictureCallback, .IPictureCallback) to indicate still image capture.
StartVideoRecordingMediaActionSoundType (2). The sound used by MediaRecorder.Start to indicate the start of video recording.
StopVideoRecordingMediaActionSoundType (3). The sound used by MediaRecorder.Stop to indicate the end of video recording.

Protected Properties

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

Public Methods

Preload a predefined platform sound to minimize latency when the sound is played later by MediaActionSound.Play(MediaActionSoundType).
LoadAsync(MediaActionSoundType) : Task
Free up all audio resources used by this MediaActionSound instance.