An extensible media player for Android
This is the last planned release of the com.google.android.exoplayer2
artifacts. This project is now deprecated. All users should migrate to androidx.media3
(which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
This release corresponds to the AndroidX Media3 1.1.1 release.
multidex
dependency from all modules (#499).PlaybackStatsListener
where spurious PlaybackStats
are created after the playlist is cleared.Player.getState()
never transitioned to STATE_ENDED
when playing very short files (#538).This is the last planned release of the com.google.android.exoplayer2
artifacts. This project is now deprecated. All users should migrate to androidx.media3
(which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
This release corresponds to the AndroidX Media3 1.1.0 release.
COMMAND_GET_METADATA
COMMAND_SET_PLAYLIST_METADATA
COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS
COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS
void setDeviceVolume(int, int)
void increaseDeviceVolume(int)
void decreaseDeviceVolume(int)
void setDeviceMuted(boolean, int)
Builder
for DeviceInfo
and deprecate existing constructor.DeviceInfo.routingControllerId
to specify the routing controller ID for remote playbacks.Player.replaceMediaItem(s)
as a shortcut to adding and removing items at the same position (#8046).ExoPlayer.Builder.setDeviceVolumeControlEnabled
to have access to:
getDeviceVolume()
isDeviceMuted()
setDeviceVolume(int)
and setDeviceVolume(int, int)
increaseDeviceVolume(int)
and increaseDeviceVolume(int, int)
decreaseDeviceVolume(int)
and decreaseDeviceVolume(int, int)
FilteringMediaSource
that allows to filter available track types from a MediaSource
.br
, bl
, cid
, rtp
, and sid
, have been incorporated (#8699). API structure and API methods:
MediaSource.Factory.setCmcdConfigurationFactory(CmcdConfiguration.Factory cmcdConfigurationFactory)
to enable it.CmcdConfiguration.RequestConfig.isKeyAllowed(String key)
to filter out which keys are logged.CmcdConfiguration.RequestConfig.getCustomData()
to enable custom key logging.*.exolist.json
file (#439).ExoPlayer.setVideoEffects()
for using Effect
during video playback.SampleQueue
to store sourceId
as a long
rather than an int
. This changes the signatures of public methods SampleQueue.sourceId
and SampleQueue.peekSourceId
.LoadControl
methods shouldStartPlayback
and onTracksSelected
that allow associating these methods with the relevant MediaPeriod
.ServerSideAdInsertionMediaSource.setAdPlaybackStates(Map<Object, AdPlaybackState>)
by adding a timeline parameter that contains the periods with the UIDs used as keys in the map. This is required to avoid concurrency issues with multi-period live streams.EventDispatcher.withParameters(int windowIndex, @Nullable MediaPeriodId mediaPeriodId, long mediaTimeOffsetMs)
and BaseMediaSource.createEventDispatcher(..., long mediaTimeOffsetMs)
. The variant of the methods without the mediaTimeOffsetUs
can be called instead. Note that even for the deprecated variants, the offset is not anymore added to startTimeUs
and endTimeUs
of the MediaLoadData
objects that are dispatched by the dispatcher.ExoTrackSelection.blacklist
to excludeTrack
and isBlacklisted
to isTrackExcluded
.ExoPlayer.setMediaItem(s)
and addMediaItem(s)
when called on an empty playlist.Transformer.Builder.setMediaSourceFactory(MediaSource.Factory)
. Use ExoPlayerAssetLoader.Factory(MediaSource.Factory)
and Transformer.Builder.setAssetLoaderFactory(AssetLoader.Factory)
instead.Transformer.startTransformation(MediaItem, ParcelFileDescriptor)
.MediaCodecList
instead of using findDecoder/EncoderForFormat
utilities, to expand support.DefaultEncoderFactory
because it doesn't work on some devices.DefaultTrackSelector.Parameters.allowInvalidateSelectionsForRendererCapabilitiesChange
which is disabled by default. When enabled, the DefaultTrackSelector
will trigger a new track selection when the renderer capabilities changed.AudioProcessors
are active, e.g. for gapless trimming (#10847).Renderer.release()
and AudioSink.release()
for releasing the resources at the end of player's lifecycle.DefaultAudioSink
. Add a required parameter context
in the constructor of DefaultAudioSink
, with which the DefaultAudioSink
will register as the listener to the AudioCapabilitiesReceiver
and update its audioCapabilities
property when informed with a capabilities change.onAudioCapabilitiesChanged
in AudioSink.Listener
interface, and a new interface RendererCapabilities.Listener
which triggers onRendererCapabilitiesChanged
events.ChannelMixingAudioProcessor
for applying scaling/mixing to audio channels.DISCARD_REASON_AUDIO_BYPASS_POSSIBLE
to DecoderDiscardReasons
to discard audio decoder when bypass mode is possible after audio capabilities change.MediaCodecVideoRenderer
report a VideoSize
with a width and height of 0 when the renderer is disabled. Player.Listener.onVideoSizeChanged
is called accordingly when Player.getVideoSize()
changes. With this change, ExoPlayer's video size with MediaCodecVideoRenderer
has a width and height of 0 when Player.getCurrentTracks
does not support video, or the size of the supported video track is not yet determined.DefaultDrmSession
that aren't expected to be called from outside the DRM package:
void onMediaDrmEvent(int)
void provision()
void onProvisionCompleted()
onProvisionError(Exception, boolean)
shouldShowPlayButton
and handlePlayPauseButtonAction
to write custom UI elements with a play/pause button.MediaLoadData.startTimeMs
and MediaLoadData.endTimeMs
for multi period DASH streams.IndexOutOfBoundsException
(#10838).HlsMediaSource.Factory.setTimestampAdjusterInitializationTimeoutMs(long)
to set a timeout for the loading thread to wait for the TimestampAdjuster
to initialize. If the initialization doesn't complete before the timeout, a PlaybackException
is thrown to avoid the playback endless stalling. The timeout is set to zero by default (#323).DataSourceContractTest
.DefaultAudioSink
constructors, use DefaultAudioSink.Builder
instead.HlsMasterPlaylist
, use HlsMultivariantPlaylist
instead.Player.stop(boolean)
. Use Player.stop()
and Player.clearMediaItems()
(if reset
is true
) instead.SimpleCache
constructors, use a non-deprecated constructor that takes a DatabaseProvider
instead for better performance.DefaultBandwidthMeter
constructor, use DefaultBandwidthMeter.Builder
instead.DefaultDrmSessionManager
constructors, use DefaultDrmSessionManager.Builder
instead.HttpDataSource.InvalidResponseCodeException
constructors, use a non-deprecated constructor that accepts additional fields(cause
, responseBody
) to enhance error logging.DownloadHelper.forProgressive
, DownloadHelper.forHls
, DownloadHelper.forDash
, and DownloadHelper.forSmoothStreaming
, use DownloadHelper.forMediaItem
instead.DownloadService
constructor, use a non deprecated constructor that includes the option to provide a channelDescriptionResourceId
parameter.ASCII_NAME
, UTF8_NAME
, ISO88591_NAME
, UTF16_NAME
and UTF16LE_NAME
), use Kotlin Charsets from the kotlin.text
package, the java.nio.charset.StandardCharsets
or the com.google.common.base.Charsets
instead.WorkManagerScheduler
constructor, use a non deprecated constructor that includes the option to provide a Context
parameter instead.createVideoSampleFormat
, createAudioSampleFormat
, createContainerFormat
, and createSampleFormat
, which were used to instantiate the Format
class. Instead use Format.Builder
for creating instances of Format
.copyWithMaxInputSize
, copyWithSubsampleOffsetUs
, copyWithLabel
, copyWithManifestFormatInfo
, copyWithGaplessInfo
, copyWithFrameRate
, copyWithDrmInitData
, copyWithMetadata
, copyWithBitrate
and copyWithVideoSize
, use Format.buildUpon()
and setter methods instead.ExoPlayer.retry()
, use prepare()
instead.DefaultTrackSelector
constructor, use DefaultTrackSelector(Context)
instead.OfflineLicenseHelper
constructor, use OfflineLicenseHelper(DefaultDrmSessionManager, DrmSessionEventListener.EventDispatcher)
instead.DownloadManager
constructor, use the constructor that takes an Executor
instead.Cue
constructors, use Cue.Builder
instead.OfflineLicenseHelper
constructor, use OfflineLicenseHelper(DefaultDrmSessionManager, DrmSessionEventListener.EventDispatcher)
instead.AnalyticsListener
methods:
onDecoderEnabled
, use onAudioEnabled
and/or onVideoEnabled
instead.onDecoderInitialized
, use onAudioDecoderInitialized
and/or onVideoDecoderInitialized
instead.onDecoderInputFormatChanged
, use onAudioInputFormatChanged
and/or onVideoInputFormatChanged
instead.onDecoderDisabled
, use onAudioDisabled
and/or onVideoDisabled
instead.Player.Listener.onSeekProcessed
and AnalyticsListener.onSeekProcessed
, use onPositionDiscontinuity
with DISCONTINUITY_REASON_SEEK
instead.ExoPlayer.setHandleWakeLock(boolean)
, use setWakeMode(int)
instead.DefaultLoadControl.Builder.createDefaultLoadControl()
, use build()
instead.This release corresponds to the AndroidX Media3 1.0.2 release.
Buffer.isLastSample()
that denotes if Buffer
contains flag C.BUFFER_FLAG_LAST_SAMPLE
.This release corresponds to the AndroidX Media3 1.0.1 release.
This release corresponds to the AndroidX Media3 1.0.0 release.
There are no changes since 2.18.4.
This release corresponds to the AndroidX Media3 1.0.0-rc02 release.
SegmentDownloader
and subclasses (#248).HEVCProfileMain10HDR10
instead of HEVCProfileMain10
.STATE_IDLE
when transitioning between media items (#245).LOADED
event wasn't received.MediaCodecSelector
's preferences, even if a decoder reports it may not be able to play the media performantly. For example with default selector, hardware decoder with only functional support will be preferred over software decoder that fully supports the format (#10604).ExoPlayer.Builder.setPlaybackLooper
that sets a pre-existing playback thread for a new ExoPlayer instance.BasePlayer.seekTo
to also indicate the command used for seeking.ConcatenatingMediaSource2
that allows combining multiple media items into a single window (#247).ParserException
instead of a NullPointerException
if the sample table (stbl) is missing a required sample description (stsd) when parsing trak atoms.AudioTrack
in direct playbacks (passthrough).TextRenderer
passing an invalid (negative) index to Subtitle.getEventTime
if a subtitle file contains no cues.MediaMetadata.mediaType
to denote the type of content or the type of folder described by the metadata.MediaMetadata.isBrowsable
as a replacement for MediaMetadata.folderType
. The folder type will be deprecated in the next release.StyledPlayerView.setControllerVisibilityListener(StyledPlayerControlView.VisibilityListener)
to ensure visibility changes are passed to the registered listener (#229).StyledPlayerView
when using a right-to-left (RTL) layout (#227).ImaServerSideAdInsertionMediaSource
on the application thread to avoid threading issues.focusSkipButtonWhenAvailable
to the ImaServerSideAdInsertionMediaSource.AdsLoader.Builder
to request focusing the skip button on TV devices and set it to true by default.focusSkipButton()
to the ImaServerSideAdInsertionMediaSource.AdsLoader
to programmatically request to focus the skip button.This release corresponds to the AndroidX media3 1.0.0-beta02 release.
ShuffleOrder
with ExoPlayer.setShuffleOrder
results in a call to Player.Listener#onTimelineChanged
with reason=Player.TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED
(#9889).setDataSourceFactory
in DefaultMediaSourceFactory
, which was non-functional in some cases (#116).playWhenReady
changes in LeanbackAdapter
(10420).This release corresponds to the AndroidX media3 1.0.0-beta01 release.
MediaMetricsManager
. ExoPlayer will forward playback events and performance data to the platform, which helps to provide system performance and debugging information on the device. This data may also be collected by Google if sharing usage and diagnostics data is enabled by the user of the device. Apps can opt-out of contributing to platform diagnostics for ExoPlayer with ExoPlayer.Builder.setUsePlatformDiagnostics(false)
.MergingMediaSource
, for example when side-loading subtitles and changing the selected subtitle mid-playback (#10248).null
to MediaSource.Factory.setDrmSessionManagerProvider
and MediaSource.Factory.setLoadErrorHandlingPolicy
. Instances of DefaultDrmSessionManagerProvider
and DefaultLoadErrorHandlingPolicy
can be passed explicitly if required.MediaItem.RequestMetadata
to represent metadata needed to play media when the exact LocalConfiguration
is not known. Also remove MediaMetadata.mediaUrl
as this is now included in RequestMetadata
.Player.Command.COMMAND_SET_MEDIA_ITEM
to enable players to allow setting a single item.TrackSelectionOverrides
class into TrackSelectionParameters
, and promote TrackSelectionOverride
to a top level class.TracksInfo
to Tracks
and TracksInfo.TrackGroupInfo
to Tracks.Group
. Player.getCurrentTracksInfo
and Player.Listener.onTracksInfoChanged
have also been renamed to Player.getCurrentTracks
and Player.Listener.onTracksChanged
. This includes 'un-deprecating' the Player.Listener.onTracksChanged
method name, but with different parameter types.DefaultTrackSelector.buildUponParameters
and DefaultTrackSelector.Parameters.buildUpon
to return DefaultTrackSelector.Parameters.Builder
instead of the deprecated DefaultTrackSelector.ParametersBuilder
.DefaultTrackSelector.Parameters.constrainAudioChannelCountToDeviceCapabilities
which is enabled by default. When enabled, the DefaultTrackSelector
will prefer audio tracks whose channel count does not exceed the device output capabilities. On handheld devices, the DefaultTrackSelector
will prefer stereo/mono over multichannel audio formats, unless the multichannel format can be Spatialized (Android 12L+) or is a Dolby surround sound format. In addition, on devices that support audio spatialization, the DefaultTrackSelector
will monitor for changes in the Spatializer properties and trigger a new track selection upon these. Devices with a television
UI mode are excluded from these constraints and the format with the highest channel count will be preferred. To enable this feature, the DefaultTrackSelector
instance must be constructed with a Context
.DummySurface
to PlaceholderSurface
.MediaCodecVideoRenderer.getCodecMaxInputSize
.AudioAttributes.getAudioAttributesV21()
from android.media.AudioAttributes
to a new AudioAttributesV21
wrapper class, to prevent slow ART verification on API < 21.AudioTrack
with channel mask AudioFormat.CHANNEL_OUT_7POINT1POINT4
if the decoder outputs 12 channel PCM audio (#10322.Player.getCurrentCues()
to return CueGroup
instead of List<Cue>
.OutlineColour
style setting when BorderStyle == 3
(i.e. OutlineColour
sets the background of the cue) (#8435).RawCcExtractor
, which was only used to handle a Google-internal subtitle format.DiscardPadding
for Opus tracks.esds
boxes.OnClickListener
s set on StyledPlayerView
and PlayerView
, in the case that useController=false
(#9605). Also fix delivery of events to OnLongClickListener
for all view configurations.StyledPlayerView
and PlayerView
before ACTION_UP
as a click (#9861).PlayerView
accessibility issue where tapping might toggle playback rather than hiding the controls (#8627).TrackSelectionView
and TrackSelectionDialogBuilder
to work with the Player
interface rather than ExoPlayer
. This allows the views to be used with other Player
implementations, and removes the dependency from the UI module to the ExoPlayer module. This is a breaking change.PlayerView
track selector, and keep a suitable forced text track selected if "None" is selected (#9432).AudioChannelConfiguration
elements. This re-enables audio passthrough for DTS streams (#10159).null
to DashMediaSource.Factory.setCompositeSequenceableLoaderFactory
. Instances of DefaultCompositeSequenceableLoaderFactory
can be passed explicitly if required.null
to HlsMediaSource.Factory.setCompositeSequenceableLoaderFactory
, HlsMediaSource.Factory.setPlaylistParserFactory
, and HlsMediaSource.Factory.setPlaylistTrackerFactory
. Instances of DefaultCompositeSequenceableLoaderFactory
, DefaultHlsPlaylistParserFactory
, or a reference to DefaultHlsPlaylistTracker.FACTORY
can be passed explicitly if required.null
to SsMediaSource.Factory.setCompositeSequenceableLoaderFactory
. Instances of DefaultCompositeSequenceableLoaderFactory
can be passed explicitly if required.DummyDataSource
to PlaceholderDataSource
.3.21.0+
to avoid a CMake bug causing AndroidStudio's gradle sync to fail (#9933).Player.Listener.onTracksChanged(TrackGroupArray, TrackSelectionArray)
. Use Player.Listener.onTracksChanged(Tracks)
instead.Player.getCurrentTrackGroups
and Player.getCurrentTrackSelections
. Use Player.getCurrentTracks
instead. You can also continue to use ExoPlayer.getCurrentTrackGroups
and ExoPlayer.getCurrentTrackSelections
, although these methods remain deprecated.DownloadHelper
DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_VIEWPORT
and DEFAULT_TRACK_SELECTOR_PARAMETERS
constants. Use getDefaultTrackSelectorParameters(Context)
instead when possible, and DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT
otherwise.DefaultTrackSelector(ExoTrackSelection.Factory)
. Use DefaultTrackSelector(Context, ExoTrackSelection.Factory)
instead.Transformer.Builder.setContext
. The Context
should be passed to the Transformer.Builder
constructor instead.