androidx.media3.common
Interfaces
AdViewProvider |
Provides information about views for the ad playback UI. |
DataReader |
Reads bytes from a data stream. |
DebugViewProvider |
Provider for views to show diagnostic information during an export, for debugging. |
Effect |
Marker interface for a video frame effect. |
ErrorMessageProvider |
Converts throwables into error codes and user readable error messages. |
GlObjectsProvider |
Provider to customize the creation and maintenance of GL objects. |
Metadata.Entry |
A metadata entry. |
OnInputFrameProcessedListener |
A listener for processing input frames. |
OverlaySettings |
Provides information of how an input texture (for example, a |
Player |
A media player interface defining high-level functionality, such as the ability to play, pause, seek and query properties of the currently playing media. |
Player.Listener |
Listener for changes in a |
SimpleBasePlayer.PositionSupplier |
A supplier for a position. |
VideoCompositorSettings |
Settings for the |
VideoFrameProcessor |
Interface for a video frame processor that applies changes to individual video frames. |
VideoFrameProcessor.Factory |
A factory for |
VideoFrameProcessor.Listener |
Listener for asynchronous frame processing events. |
VideoGraph |
Represents a graph for processing raw video frames. |
VideoGraph.Factory |
A factory for |
VideoGraph.Listener |
Listener for video frame processing events. |
ViewProvider |
Provider of a view to be displayed in the player UI. |
Classes
AdOverlayInfo |
Provides information about an overlay view shown on top of an ad view group. |
AdOverlayInfo.Builder |
A builder for |
AdPlaybackState |
Represents ad group times and information on the state and URIs of ads within each ad group. |
AdPlaybackState.AdGroup |
Represents a group of ads, with information about their states. |
AdPlaybackState.SkipInfo |
Information about skipping an ad. |
AudioAttributes |
Attributes for audio playback, which configure the underlying platform |
AudioAttributes.AudioAttributesV21 |
This class is deprecated. |
AudioAttributes.Builder |
Builder for |
AuxEffectInfo |
Represents auxiliary effect information, which can be used to attach an auxiliary effect to an underlying |
BasePlayer |
Abstract base |
BundleListRetriever |
A |
BundleableByteArray |
A wrapper for byte arrays that allows them to be transferred over |
C |
Defines constants used by the library. |
ColorInfo |
Stores color info. |
ColorInfo.Builder |
Builds |
DeviceInfo |
Information about the playback device. |
DeviceInfo.Builder |
Builder for |
DrmInitData |
Initialization data for one or more DRM schemes. |
DrmInitData.SchemeData |
Scheme initialization data. |
FileTypes |
Defines common file type constants and helper methods. |
FlagSet |
A set of integer flags. |
FlagSet.Builder |
A builder for |
Format |
Represents a media format. |
Format.Builder |
Builds |
ForwardingPlayer |
|
ForwardingSimpleBasePlayer |
A |
FrameInfo |
Value class specifying information about a decoded video frame. |
GlTextureInfo |
Contains information describing an OpenGL texture. |
HeartRating |
A rating expressed as "heart" or "no heart". |
Label |
A label for a |
MediaItem |
Representation of a media item. |
MediaItem.AdsConfiguration |
Configuration for playing back linear ads with a media item. |
MediaItem.AdsConfiguration.Builder |
Builder for |
MediaItem.Builder |
A builder for |
MediaItem.ClippingConfiguration |
Optionally clips the media item to a custom start and end position. |
MediaItem.ClippingConfiguration.Builder |
Builder for |
MediaItem.ClippingProperties |
This class is deprecated. Use |
MediaItem.DrmConfiguration |
DRM configuration for a media item. |
MediaItem.DrmConfiguration.Builder |
Builder for |
MediaItem.LiveConfiguration |
Live playback configuration. |
MediaItem.LiveConfiguration.Builder |
Builder for |
MediaItem.LocalConfiguration |
Properties for local playback. |
MediaItem.RequestMetadata |
Metadata that helps the player to understand a playback request represented by a |
MediaItem.RequestMetadata.Builder |
Builder for |
MediaItem.Subtitle |
This class is deprecated. Use |
MediaItem.SubtitleConfiguration |
Properties for a text track. |
MediaItem.SubtitleConfiguration.Builder |
Builder for |
MediaLibraryInfo |
Information about the media libraries. |
MediaMetadata |
Metadata of a |
MediaMetadata.Builder |
A builder for |
Metadata |
A collection of metadata entries. |
MimeTypes |
Defines common MIME types and helper methods. |
PercentageRating |
A rating expressed as a percentage. |
PlaybackParameters |
Parameters that apply to playback, including speed setting. |
Player.Commands |
A set of |
Player.Commands.Builder |
A builder for |
Player.Events |
A set of |
Player.PositionInfo |
Position info describing a playback position involved in a discontinuity. |
PlayerPool |
A pool of |
PlayerTransferState |
Holds a snapshot of a |
PlayerTransferState.Builder |
Builder for |
PriorityTaskManager |
Allows tasks with associated |
Rating |
A rating for media content. |
SimpleBasePlayer |
A base implementation for |
SimpleBasePlayer.LivePositionSupplier |
A |
SimpleBasePlayer.MediaItemData |
An immutable description of an item in the playlist, containing both static setup information like |
SimpleBasePlayer.MediaItemData.Builder |
A builder for |
SimpleBasePlayer.PeriodData |
Data describing the properties of a period inside a |
SimpleBasePlayer.PeriodData.Builder |
A builder for |
SimpleBasePlayer.State |
An immutable state description of the player. |
SimpleBasePlayer.State.Builder |
A builder for |
SpeedParameters |
Class that holds information about how to apply a speed-changing effect. |
StarRating |
A rating expressed as a fractional number of stars. |
StreamKey |
A key for a subset of media that can be separately loaded (a "stream"). |
SurfaceInfo |
Immutable value class for a |
ThumbRating |
A rating expressed as "thumbs up" or "thumbs down". |
Timeline |
A flexible representation of the structure of media. |
Timeline.Period |
Holds information about a period in a |
Timeline.RemotableTimeline |
A concrete class of |
Timeline.Window |
Holds information about a window in a |
TrackGroup |
An immutable group of tracks available within a media stream. |
TrackSelectionOverride |
A track selection override, consisting of a |
TrackSelectionParameters |
Parameters for controlling track selection. |
TrackSelectionParameters.AudioOffloadPreferences |
Preferences and constraints for enabling audio offload. |
TrackSelectionParameters.AudioOffloadPreferences.Builder |
A builder for |
TrackSelectionParameters.Builder |
A builder for |
Tracks |
Information about groups of tracks. |
Tracks.Group |
Information about a single group of tracks, including the underlying |
VideoSize |
Represents the video size. |
Exceptions
IllegalSeekPositionException |
Thrown when an attempt is made to seek to a position that does not exist in the player's |
ParserException |
Thrown when an error occurs parsing media data and metadata. |
PlaybackException |
Thrown when a non locally recoverable playback failure occurs. |
PriorityTaskManager.PriorityTooLowException |
Thrown when task attempts to proceed when another registered task has a higher priority. |
VideoFrameProcessingException |
Thrown when an exception occurs while preparing an |
Annotations
AdOverlayInfo.Purpose |
The purpose of the overlay. |
AdPlaybackState.AdState |
Represents the state of an ad in an ad group. |
C.AudioAllowedCapturePolicy |
Capture policies for audio attributes. |
C.AudioContentType |
Content types for audio attributes. |
C.AudioFlags |
Flags for audio attributes. |
C.AudioUsage |
Usage types for audio attributes. |
C.AuxiliaryTrackType |
|
C.BufferFlags |
Flags which can apply to a buffer containing a media sample. |
C.ColorRange |
Video color range. |
C.ColorSpace |
Video color spaces, also referred to as color standards. |
C.ColorTransfer |
Video/image color transfer characteristics. |
C.ContentType |
Represents a streaming or other media type. |
C.CryptoMode |
Crypto modes for a codec. |
C.CryptoType |
Types of crypto implementation. |
C.DataType |
Represents a type of data. |
C.Encoding |
Represents an audio encoding, or an invalid or unset value. |
C.FirstFrameState |
State of the first frame in a video renderer. |
C.FormatSupport |
Level of support for a format. |
C.NetworkType |
Network connection type. |
C.PcmEncoding |
Represents a PCM audio encoding, or an invalid or unset value. |
C.Priority |
A value indicating the priority of a operation. |
C.Projection |
Video projection types. |
C.RoleFlags |
Track role flags. |
C.SelectionFlags |
Track selection flags. |
C.SelectionReason |
Represents a reason for selection. |
C.SpatializationBehavior |
Represents the behavior affecting whether spatialization will be used. |
C.StereoMode |
The stereo mode for 360/3D/VR videos. |
C.StreamType |
Stream types for an |
C.TextureMinFilter |
Texture filtering algorithm for minification. |
C.TrackType |
Represents a type of media track. |
C.VideoChangeFrameRateStrategy |
Strategies for calling |
C.VideoCodecFlags |
Flags which represent a set of video codecs. |
C.VideoOutputMode |
Video decoder output modes. |
C.VideoScalingMode |
Video scaling modes for |
C.VolumeFlags |
Volume flags to be used when setting or adjusting device volume. |
C.VolumeOperationType |
Volume operation type. |
C.WakeMode |
Mode specifying whether the player should hold a WakeLock and a WifiLock. |
DeviceInfo.PlaybackType |
Types of playback. |
FileTypes.Type |
File types. |
Format.CueReplacementBehavior |
The replacement behaviors for consecutive samples in a |
MediaMetadata.FolderType |
This annotation is deprecated. Use |
MediaMetadata.MediaType |
The type of content described by the media item. |
MediaMetadata.PictureType |
The picture type of the artwork. |
PlaybackException.ErrorCode |
Codes that identify causes of player errors. |
Player.Command |
Commands that indicate which method calls are currently permitted on a particular |
Player.DiscontinuityReason |
Reasons for position discontinuities. |
Player.Event |
Events that can be reported via |
Player.MediaItemTransitionReason |
Reasons for media item transitions. |
Player.PlayWhenReadyChangeReason |
Reasons for |
Player.PlaybackSuppressionReason |
Reason why playback is suppressed even though |
Player.RepeatMode |
Repeat modes for playback. |
Player.State |
Playback state. |
Player.TimelineChangeReason |
Reasons for timeline changes. |
TrackSelectionParameters.AudioOffloadPreferences.AudioOffloadMode |
The preference level for enabling audio offload on the audio sink. |
VideoFrameProcessor.InputType |
Specifies how the input frames are made available to the |
Extension functions summary
suspend Nothing |
@UnstableApiContinuously listens to the |
suspend Nothing |
@UnstableApiContinuously listens to the |
Extension functions
Player.listen
@UnstableApi
suspend fun Player.listen(onEvents: Player.(Player.Events) -> Unit): Nothing
Continuously listens to the Player.Listener.onEvents callback, passing the received Player.Events to the provided onEvents function.
This function can be called from any thread. The onEvents function will be invoked on the thread associated with Player.getApplicationLooper.
If, during the execution of onEvents, an exception is thrown, the coroutine corresponding to listening to the Player will be terminated. Any used resources will be cleaned up (e.g. removing of the listeners) and exception will be re-thrown right after the last suspension point.
| Parameters | |
|---|---|
onEvents: Player.(Player.Events) -> Unit |
The function to handle player events. |
| Returns | |
|---|---|
Nothing |
Nothing This function never returns normally. It will either continue indefinitely or terminate due to an exception or cancellation. |
Player.listenTo
@UnstableApi
suspend fun Player.listenTo(
firstEvent: @Player.Event Int,
vararg otherEvents: Int,
onEvents: Player.(Player.Events) -> Unit
): Nothing
Continuously listens to the Player.Listener.onEvents callback, passing the received Player.Events to the provided onEvents function. A non-zero number of events has to be specified (hence firstEvent and otherEvents). The order is not important.
This function can be called from any thread. The onEvents function will be invoked on the thread associated with Player.getApplicationLooper.
If, during the execution of onEvents, an exception is thrown, the coroutine corresponding to listening to the Player will be terminated. Any used resources will be cleaned up (e.g. removing of the listeners) and exception will be re-thrown right after the last suspension point.
| Parameters | |
|---|---|
firstEvent: @Player.Event Int |
One of the |
vararg otherEvents: Int |
The set of other |
onEvents: Player.(Player.Events) -> Unit |
The function to handle player events. |
| Returns | |
|---|---|
Nothing |
Nothing This function never returns normally. It will either continue indefinitely or terminate due to an exception or cancellation. |