Android Guides | Samples

Android.Media Namespace

The Media APIs are used to play and, in some cases, record media files.

Remarks

Provides classes that manage various media interfaces in audio and video.

The Media APIs are used to play and, in some cases, record media files. This includes audio (e.g., play MP3s or other music files, ringtones, game sound effects, or DTMF tones) and video (e.g., play a video streamed over the web or from local storage).

Other special classes in the package offer the ability to detect the faces of people in Bitmaps (FaceDetector), control audio routing (to the device or a headset) and control alerts such as ringtones and phone vibrations (AudioManager).

Classes

TypeReason
AdjustEnumerates values returned by the Adjust.Lower, Adjust.Raise, and Adjust.Same members and taken as a parameter of several types.
AsyncPlayerPlays a series of audio URIs, but does all the hard work on another thread so that any slowness with preparing or loading doesn't block the calling thread.
AudioAttributesA class to encapsulate a collection of attributes describing information about an audio stream.
AudioAttributes+Builder
AudioAttributes+InterfaceConsts
AudioContentTypeEnumerates values returned by several types and taken as a parameter of the AudioAttributes+Builder.SetContentType member.
AudioEncoderEnumerates values returned by several types and taken as a parameter of the MediaRecorder.SetAudioEncoder member.
AudioFlagsEnumerates values returned by several types and taken as a parameter of the AudioAttributes+Builder.SetFlags, MediaController.AdjustVolume, and MediaController.SetVolumeTo members.
AudioFocusEnumerates values returned by several types and taken as a parameter of the Android.Media.AudioManager.AudioFocusChangeEventArgs..ctor, AudioManager+IOnAudioFocusChangeListener.OnAudioFocusChange, and AudioManager.RequestAudioFocus members.
AudioFocusRequestEnumerates values returned by several types.
AudioFormatThe AudioFormat class is used to access a number of audio format and channel configuration constants.
AudioFormat+Builder
AudioManagerAudioManager provides access to volume and ringer mode control.
AudioManager+AudioFocusChangeEventArgs
AudioManager+IOnAudioFocusChangeListenerInterface definition for a callback to be invoked when the audio focus of the system is updated.
AudioRecordThe AudioRecord class manages the audio resources for Java applications to record audio from the audio input hardware of the platform.
AudioRecord+IOnRecordPositionUpdateListenerInterface definition for a callback to be invoked when an AudioRecord has reached a notification marker set by AudioRecord.SetNotificationMarkerPosition(Int32) or for periodic updates on the progress of the record head, as set by AudioRecord.SetPositionNotificationPeriod(Int32).
AudioRecord+MarkerReachedEventArgsProvides data for the AudioRecord.MarkerReached event.
AudioRecord+PeriodicNotificationEventArgsProvides data for the AudioRecord.PeriodicNotification event.
AudioSourceEnumerates values returned by several types and taken as a parameter of the Android.Media.AudioRecord..ctor, and MediaRecorder.SetAudioSource members.
AudioTimestampStructure that groups a position in frame units relative to an assumed audio stream, together with the estimated time when that frame was presented or is committed to be presented.
AudioTrackThe AudioTrack class manages and plays a single audio resource for Java applications.
AudioTrack+IOnPlaybackPositionUpdateListenerInterface definition for a callback to be invoked when the playback head position of an AudioTrack has reached a notification marker or has increased by a certain period.
AudioTrack+MarkerReachedEventArgsProvides data for the AudioTrack.MarkerReached event.
AudioTrack+PeriodicNotificationEventArgsProvides data for the AudioTrack.PeriodicNotification event.
AudioTrackModeEnumerates values returned by the AudioTrackMode.Static, and AudioTrackMode.Stream members and taken as a parameter of several methods of AudioTrack.
AudioTrackStateEnumerates values returned by several types.
AudioUsageKindEnumerates values returned by several methods of AudioUsageKind.
BitmapKeyEnumerates values returned by the BitmapKey.Artwork, and RemoteControlClient+MetadataEditor.BitmapKeyArtwork members and taken as a parameter of the RemoteControlClient+MetadataEditor.PutBitmap member.
BitrateModeEnumerates values returned by the BitrateMode.Cbr, BitrateMode.Cq, and BitrateMode.Vbr members and taken as a parameter of the MediaCodecInfo+EncoderCapabilities.IsBitrateModeSupported member.
CamcorderProfileRetrieves the predefined camcorder profile settings for camcorder applications.
CamcorderQualityEnumerates values returned by several types and taken as a parameter of several methods of CamcorderProfile.
CameraProfileThe CameraProfile class is used to retrieve the pre-defined still image capture (jpeg) quality levels (0-100) used for low, medium, and high quality settings in the Camera application.
CameraQualityEnumerates values returned by several types and taken as a parameter of the CameraProfile.GetJpegEncodingQualityParameter, and CameraProfile.GetJpegEncodingQualityParameter members.
ChannelConfigurationEnumerates values returned by several methods of ChannelConfiguration and taken as a parameter of the Android.Media.AudioTrack..ctor, and Android.Media.AudioTrack..ctor members.
ChannelInEnumerates values returned by several types and taken as a parameter of several types.
ChannelOutEnumerates values returned by several types and taken as a parameter of several types.
DeniedByServerExceptionException thrown when the provisioning server or key server denies a certficate or license for a device.
EncodingEnumerates values returned by several types and taken as a parameter of several types.
EulerEnumerates values returned by the Euler.X, Euler.Y, and Euler.Z members and taken as a parameter of the FaceDetector+Face.Pose member.
ExifInterfaceThis is a class for reading and writing Exif tags in a JPEG file.
FaceDetectorIdentifies the faces of people in a Bitmap graphic object.
FaceDetector+FaceA Face contains all the information identifying the location of a face in a bitmap.
Image
Image+Plane
ImageReader
ImageReader+ImageAvailableEventArgs
ImageReader+IOnImageAvailableListener
JetPlayerJetPlayer provides access to JET content playback and control.
JetPlayer+IOnJetEventListenerHandles the notification when the JET engine generates an event.
JetPlayer+JetEventEventArgsProvides data for the JetPlayer.JetEvent event.
JetPlayer+JetNumQueuedSegmentUpdateEventArgsProvides data for the JetPlayer.JetNumQueuedSegmentUpdate event.
JetPlayer+JetPauseUpdateEventArgsProvides data for the JetPlayer.JetPauseUpdate event.
JetPlayer+JetUserIdUpdateEventArgsProvides data for the JetPlayer.JetUserIdUpdate event.
MediaActionSound
MediaActionSoundTypeEnumerates values returned by several types and taken as a parameter of the MediaActionSound.Load, MediaActionSound.LoadAsync, and MediaActionSound.Play members.
MediaCodecMediaCodec class can be used to access low-level media codecs, i.e. encoder/decoder components.
MediaCodec+BufferInfoPer buffer metadata includes an offset and size specifying the range of valid data in the associated codec buffer.
MediaCodec+Callback
MediaCodec+CodecException
MediaCodec+CryptoException
MediaCodec+CryptoInfoMetadata describing the structure of a (at least partially) encrypted input sample.
MediaCodecBufferFlagsEnumerates values returned by several types and taken as a parameter of the MediaCodec+BufferInfo.Set, MediaCodec.QueueInputBuffer, and MediaCodec.QueueSecureInputBuffer members.
MediaCodecCapabilitiesEnumerates values returned by several types.
MediaCodecConfigFlagsEnumerates values returned by the MediaCodec.ConfigureFlagEncode, MediaCodecConfigFlags.Encode, and MediaCodecConfigFlags.None members and taken as a parameter of the MediaCodec.Configure member.
MediaCodecCryptoErrorTypeEnumerates values returned by several types and taken as a parameter of the Android.Media.MediaCodec.CryptoException..ctor member.
MediaCodecCryptoModeEnumerates values returned by several types and taken as a parameter of the MediaCodec+CryptoInfo.Set member.
MediaCodecInfoProvides information about a given media codec available on the device.
MediaCodecInfo+AudioCapabilities
MediaCodecInfo+CodecCapabilitiesEncapsulates the capabilities of a given codec component, i.e. what profile/level combinations it supports and what colorspaces it is capable of providing the decoded data in.
MediaCodecInfo+CodecProfileLevel
MediaCodecInfo+EncoderCapabilities
MediaCodecInfo+VideoCapabilities
MediaCodecInfoStateEnumerates values returned by several types.
MediaCodecListAllows you to enumerate available codecs, each specified as a MediaCodecInfo object, find a codec supporting a given format and query the capabilities of a given codec.
MediaCodecListKindEnumerates values returned by the MediaCodecListKind.AllCodecs, and MediaCodecListKind.RegularCodecs members and taken as a parameter of the Android.Media.MediaCodecList..ctor member.
MediaCodecProfileLevelEnumerates values returned by several types and taken as a parameter of the MediaCodecInfo+CodecCapabilities.CreateFromProfileLevel member.
MediaCodecProfileTypeEnumerates values returned by several types.
MediaCryptoMediaCrypto class can be used in conjunction with MediaCodec to decode encrypted media data.
MediaCryptoExceptionException thrown if MediaCrypto object could not be instantiated or if unable to perform an operation on the MediaCrypto object.
MediaDescriptionA simple set of metadata for a media item suitable for display.
MediaDescription+Builder
MediaDescription+InterfaceConsts
MediaDrmMediaDrm can be used to obtain keys for decrypting protected media streams, in conjunction with MediaCrypto.
MediaDrm+CryptoSessionIn addition to supporting decryption of DASH Common Encrypted Media, the MediaDrm APIs provide the ability to securely deliver session keys from an operator's session key server to a client device, based on the factory-installed root of trust, and then perform encrypt, decrypt, sign and verify operations with the session key on arbitrary user data.
MediaDrm+IOnEventListenerInterface definition for a callback to be invoked when a drm event occurs
MediaDrm+KeyRequestContains the opaque data an app uses to request keys from a license server
MediaDrm+MediaDrmEventArgsProvides data for the MediaDrm.MediaDrmEvent event.
MediaDrm+MediaDrmStateException
MediaDrm+ProvisionRequestContains the opaque data an app uses to request a certificate from a provisioning server
MediaDrmEventTypeEnumerates values returned by several types and taken as a parameter of the MediaDrm+IOnEventListener.OnEvent, and Android.Media.MediaDrm.MediaDrmEventArgs..ctor members.
MediaDrmExceptionBase class for MediaDrm exceptions
MediaDrmKeyTypeEnumerates values returned by several types.
MediaErrorEnumerates values returned by several types and taken as a parameter of the Android.Media.MediaPlayer.ErrorEventArgs..ctor, and MediaPlayer+IOnErrorListener.OnError members.
MediaExtractorMediaExtractor facilitates extraction of demuxed, typically encoded, media data from a data source.
MediaExtractorSampleFlagsEnumerates values returned by several types.
MediaExtractorSeekToEnumerates values returned by several types and taken as a parameter of the MediaExtractor.SeekTo member.
MediaFormatEncapsulates the information describing the format of media data, be it audio or video.
MediaInfoEnumerates values returned by several types and taken as a parameter of the MediaPlayer+IOnInfoListener.OnInfo, and Android.Media.MediaPlayer.InfoEventArgs..ctor members.
MediaMetadataContains metadata about an item, such as the title, artist, etc.
MediaMetadata+Builder
MediaMetadata+InterfaceConsts
MediaMetadataEditKeyEnumerates values returned by several types and taken as a parameter of several types.
MediaMetadataEditorAn abstract class for editing and storing metadata that can be published by RemoteControlClient.
MediaMetadataRetrieverMediaMetadataRetriever class provides a unified interface for retrieving frame and meta data from an input media file.
MediaMuxerMediaMuxer facilitates muxing elementary streams.
MediaMuxer+OutputFormatDefines the output format.
MediaPlaybackTypeEnumerates values returned by several types and taken as a parameter of the MediaRouter+UserRouteInfo.SetPlaybackType member.
MediaPlayerMediaPlayer class can be used to control playback of audio/video files and streams.
MediaPlayer+BufferingUpdateEventArgsProvides data for the MediaPlayer.BufferingUpdate event.
MediaPlayer+ErrorEventArgsProvides data for the MediaPlayer.Error event.
MediaPlayer+InfoEventArgsProvides data for the MediaPlayer.Info event.
MediaPlayer+IOnBufferingUpdateListenerInterface definition of a callback to be invoked indicating buffering status of a media resource being streamed over the network.
MediaPlayer+IOnCompletionListenerInterface definition for a callback to be invoked when playback of a media source has completed.
MediaPlayer+IOnErrorListenerInterface definition of a callback to be invoked when there has been an error during an asynchronous operation (other errors will throw exceptions at method call time).
MediaPlayer+IOnInfoListenerInterface definition of a callback to be invoked to communicate some info and/or warning about the media or its playback.
MediaPlayer+IOnPreparedListenerInterface definition for a callback to be invoked when the media source is ready for playback.
MediaPlayer+IOnSeekCompleteListenerInterface definition of a callback to be invoked indicating the completion of a seek operation.
MediaPlayer+IOnTimedTextListenerInterface definition of a callback to be invoked when a timed text is available for display.
MediaPlayer+IOnVideoSizeChangedListenerInterface definition of a callback to be invoked when the video size is first known or updated
MediaPlayer+TimedTextEventArgsProvides data for the MediaPlayer.TimedText event.
MediaPlayer+TrackInfoClass for MediaPlayer to return each audio/video/subtitle track's metadata.
MediaPlayer+TrackInfo+InterfaceConsts
MediaPlayer+VideoSizeChangedEventArgsProvides data for the MediaPlayer.VideoSizeChanged event.
MediaPlayerVideoScalingModeNotInUseEnumerates values returned by several types.
MediaRecorderUsed to record audio and video.
MediaRecorder+AudioEncoderDefines the audio encoding.
MediaRecorder+AudioSourceDefines the audio source.
MediaRecorder+ErrorEventArgsProvides data for the MediaRecorder.Error event.
MediaRecorder+InfoEventArgsProvides data for the MediaRecorder.Info event.
MediaRecorder+IOnErrorListenerInterface definition for a callback to be invoked when an error occurs while recording.
MediaRecorder+IOnInfoListenerInterface definition for a callback to be invoked when an error occurs while recording.
MediaRecorder+OutputFormatDefines the output format.
MediaRecorder+VideoEncoderDefines the video encoding.
MediaRecorder+VideoSourceDefines the video source.
MediaRecorderErrorEnumerates values returned by several types and taken as a parameter of the Android.Media.MediaRecorder.ErrorEventArgs..ctor, and MediaRecorder+IOnErrorListener.OnError members.
MediaRecorderInfoEnumerates values returned by several types and taken as a parameter of the MediaRecorder+IOnInfoListener.OnInfo, and Android.Media.MediaRecorder.InfoEventArgs..ctor members.
MediaRouterMediaRouter allows applications to control the routing of media channels and streams from the current device to external speakers and destination devices.
MediaRouter+CallbackInterface for receiving events about media routing changes.
MediaRouter+RouteCategoryDefinition of a category of routes.
MediaRouter+RouteGroupInformation about a route that consists of multiple other routes in a group.
MediaRouter+RouteInfoInformation about a media route.
MediaRouter+SimpleCallbackStub implementation of MediaRouter+Callback.
MediaRouter+UserRouteInfoInformation about a route that the application may define and modify.
MediaRouter+VolumeCallbackInterface for receiving events about volume changes.
MediaRouterCallbackFlagsEnumerates values returned by several types and taken as a parameter of the MediaRouter.AddCallback member.
MediaRouteTypeEnumerates values returned by several types and taken as a parameter of several types.
MediaScannerConnectionMediaScannerConnection provides a way for applications to pass a newly created or downloaded media file to the media scanner service.
MediaScannerConnection+IMediaScannerConnectionClientAn interface for notifying clients of MediaScannerConnection when a connection to the MediaScanner service has been established and when the scanning of a file has completed.
MediaScannerConnection+IOnScanCompletedListenerInterface for notifying clients of the result of scanning a requested media file.
MediaScannerConnection+ScanCompletedEventArgs
MediaSyncEventThe MediaSyncEvent class defines events that can be used to synchronize playback or capture actions between different players and recorders.
MediaSyncEventTypeEnumerates values returned by several types and taken as a parameter of the MediaSyncEvent.CreateEvent member.
MediaTrackTypeEnumerates values returned by several types and taken as a parameter of the MediaPlayer.GetSelectedTrack member.
MetadataKeyEnumerates values returned by several types and taken as a parameter of the MediaMetadataRetriever.ExtractMetadata, RemoteControlClient+MetadataEditor.PutLong, and RemoteControlClient+MetadataEditor.PutString members.
ModeEnumerates values returned by several types and taken as a parameter of the AudioManager.GetRouting, and AudioManager.SetRouting members.
MuxerOutputTypeEnumerates values returned by several types and taken as a parameter of the Android.Media.MediaMuxer..ctor member.
NotProvisionedExceptionException thrown when an operation on a MediaDrm object is attempted and the device does not have a certificate.
OptionEnumerates values returned by several types and taken as a parameter of the MediaMetadataRetriever.GetFrameAtTime member.
OrientationEnumerates values returned by several methods of Orientation and taken as a parameter of the DngCreator.SetOrientation member.
OutputFormatEnumerates values returned by several types and taken as a parameter of the MediaRecorder.SetOutputFormat member.
PlayStateEnumerates values returned by several types.
RatingA class to encapsulate rating information used as content metadata.
Rating+InterfaceConsts
RatingStyleEnumerates values returned by several types and taken as a parameter of the Rating.NewStarRating, and Rating.NewUnratedRating members.
RecordStateEnumerates values returned by the AudioRecord.RecordingState, RecordState.Recording, and RecordState.Stopped members.
RecordStatusEnumerates values returned by several types.
RemoteControlClientRemoteControlClient enables exposing information meant to be consumed by remote controls capable of displaying metadata, artwork and media transport control buttons.
RemoteControlClient+GetPlaybackPositionHandler
RemoteControlClient+IOnGetPlaybackPositionListenerInterface definition for a callback to be invoked when the media playback position is queried.
RemoteControlClient+IOnMetadataUpdateListener
RemoteControlClient+IOnPlaybackPositionUpdateListenerInterface definition for a callback to be invoked when the media playback position is requested to be updated.
RemoteControlClient+MetadataEditorClass used to modify metadata in a RemoteControlClient object.
RemoteControlClient+MetadataUpdateEventArgsProvides data for the RemoteControlClient.MetadataUpdate event.
RemoteControlClient+PlaybackPositionUpdateEventArgsProvides data for the RemoteControlClient.PlaybackPositionUpdate event.
RemoteControlFlagsEnumerates values returned by several types and taken as a parameter of the RemoteControlClient.SetTransportControlFlags, Android.Media.RemoteController.ClientTransportControlUpdateEventArgs..ctor, and RemoteController+IOnClientUpdateListener.OnClientTransportControlUpdate members.
RemoteControllerThe RemoteController class is used to control media playback, display and update media metadata and playback status, published by applications using the RemoteControlClient class.
RemoteController+ClientChangeEventArgs
RemoteController+ClientMetadataUpdateEventArgs
RemoteController+ClientPlaybackStateUpdateEventArgs
RemoteController+ClientPlaybackStateUpdateSimpleEventArgs
RemoteController+ClientTransportControlUpdateEventArgs
RemoteController+IOnClientUpdateListener
RemoteController+MetadataEditor
RemoteControlPlayStateEnumerates values returned by several types and taken as a parameter of several types.
ResourceBusyExceptionException thrown when an operation on a MediaDrm object is attempted and hardware resources are not available, due to being in use.
RingerModeEnumerates values returned by several types.
RingtoneRingtone provides a quick method for playing a ringtone, notification, or other similar types of sounds.
RingtoneColumnIndexEnumerates values returned by the RingtoneColumnIndex.Id, RingtoneColumnIndex.Title, and RingtoneColumnIndex.Uri members.
RingtoneManagerRingtoneManager provides access to ringtones, notification, and other types of sounds.
RingtoneTypeEnumerates values returned by several types and taken as a parameter of several methods of RingtoneManager.
RouteEnumerates values returned by several types and taken as a parameter of the AudioManager.SetRouting, and AudioManager.SetRouting members.
ScoAudioStateEnumerates values returned by several types.
SoundEffectEnumerates values returned by several methods of SoundEffect and taken as a parameter of the AudioManager.PlaySoundEffect, and AudioManager.PlaySoundEffect members.
SoundPoolThe SoundPool class manages and plays audio resources for applications.
SoundPool+Builder
SoundPool+IOnLoadCompleteListenerInterface definition for a callback to be invoked when all the sounds are loaded.
SoundPool+LoadCompleteEventArgsProvides data for the SoundPool.LoadComplete event.
StateEnumerates values returned by the AudioRecord.State, State.Initialized, and State.Uninitialized members.
StreamEnumerates values returned by several types and taken as a parameter of several types.
SynchronizationPositionEnumerates values returned by several types and taken as a parameter of the RemoteController.SetSynchronizationMode member.
ThumbnailUtilsThumbnail generation routines for media provider.
ThumnailExtractOptionsEnumerates values returned by the ThumbnailUtils.OptionsRecycleInput, ThumnailExtractOptions.None, and ThumnailExtractOptions.RecycleInput members and taken as a parameter of the ThumbnailUtils.ExtractThumbnail, and ThumbnailUtils.ExtractThumbnailAsync members.
TimedTextClass to hold the timed text's metadata, including:
  • The characters for rendering
  • The rendering position for the timed text
ToneEnumerates values returned by several methods of Tone and taken as a parameter of the ToneGenerator.StartTone, and ToneGenerator.StartTone members.
ToneGeneratorThis class provides methods to play DTMF tones (ITU-T Recommendation Q.23), call supervisory tones (3GPP TS 22.
TrackStatusEnumerates values returned by several types.
UnsupportedSchemeExceptionException thrown when an attempt is made to construct a MediaDrm object using a crypto scheme UUID that is not supported by the device
VibrateSettingEnumerates values returned by several types and taken as a parameter of the AudioManager.SetVibrateSetting member.
VibrateTypeEnumerates values returned by the VibrateType.Notification, and VibrateType.Ringer members and taken as a parameter of the AudioManager.GetVibrateSetting, AudioManager.SetVibrateSetting, and AudioManager.ShouldVibrate members.
VideoEncoderEnumerates values returned by several types and taken as a parameter of the MediaRecorder.SetVideoEncoder member.
VideoScalingModeEnumerates values returned by several types and taken as a parameter of the MediaCodec.SetVideoScalingMode, and MediaPlayer.SetVideoScalingMode members.
VideoSourceEnumerates values returned by the VideoSource.Camera, VideoSource.Default, and VideoSource.Surface members and taken as a parameter of the MediaRecorder.SetVideoSource member.
VolumeEnumerates values returned by several types and taken as a parameter of several types.
VolumeControlEnumerates values returned by the VolumeControl.Absolute, VolumeControl.Fixed, and VolumeControl.Relative members.
VolumeHandlingEnumerates values returned by several types and taken as a parameter of the MediaRouter+UserRouteInfo.SetVolumeHandling member.
VolumeNotificationFlagsEnumerates values returned by several methods of VolumeNotificationFlags and taken as a parameter of several methods of AudioManager.
VolumeProviderHandles requests to adjust or set the volume on a session.
WhiteBalanceEnumerates values returned by the WhiteBalance.Auto, and WhiteBalance.Manual members.
WriteModeEnumerates values returned by the WriteMode.Blocking, and WriteMode.NonBlocking members and taken as a parameter of several methods of AudioTrack.