Compartir a través de


MediaActionSound Class

Definition

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

[Android.Runtime.Register("android/media/MediaActionSound", DoNotGenerateAcw=true)]
public class MediaActionSound : Java.Lang.Object
[<Android.Runtime.Register("android/media/MediaActionSound", DoNotGenerateAcw=true)>]
type MediaActionSound = class
    inherit Object
Inheritance
MediaActionSound
Attributes

Remarks

A class for producing sounds that match those produced by various actions taken by the media and camera APIs. It is recommended to call methods in this class in a background thread since it relies on binder calls.

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 android.hardware.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 Camera.setPreviewCallback, or through GPU processing with android.hardware.Camera#setPreviewTexture Camera.setPreviewTexture, 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 Camera.takePicture or android.media.MediaRecorder for still images or video, respectively, as the Android framework will play the appropriate sounds when needed for these calls.

Java documentation for android.media.MediaActionSound.

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.

Constructors

MediaActionSound()

Construct a new MediaActionSound instance.

MediaActionSound(IntPtr, JniHandleOwnership)

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

Fields

FocusComplete
Obsolete.

A sound to indicate that focusing has completed.

ShutterClick
Obsolete.

The sound used by android.hardware.Camera#takePicture Camera.takePicture to indicate still image capture.

StartVideoRecording
Obsolete.

The sound used by android.media.MediaRecorder#start MediaRecorder.start() to indicate the start of video recording.

StopVideoRecording
Obsolete.

The sound used by android.media.MediaRecorder#stop MediaRecorder.stop() to indicate the end of video recording.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

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

ThresholdType

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

Methods

Clone()

Creates and returns a copy of this object.

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

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Load(MediaActionSoundType)

Preload a predefined platform sound to minimize latency when the sound is played later by #play.

LoadAsync(MediaActionSoundType)
MustPlayShutterSound()

Returns true if the application must play the shutter sound in accordance to certain regional restrictions.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Play(MediaActionSoundType)

Play one of the predefined platform sounds for media actions.

Release()

Free up all audio resources used by this MediaActionSound instance.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

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

Returns a string representation of the object.

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

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

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

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to