This release includes the following changes since the
1.5.1 release:
- Common Library:
- Add
AudioManagerCompatandAudioFocusRequestCompatto replace the equivalent classes inandroidx.media. - Upgrade Kotlin from 1.9.20 to 2.0.20 and use Compose Compiler Gradle plugin. Upgrade KotlinX Coroutines library from 1.8.1 to 1.9.0.
- Remove
Format.toBundle(boolean excludeMetadata)method, useFormat.toBundle()instead. - Fix bug in
SimpleBasePlayerwhere setting a newcurrentMediaItemIndexinStateaftersetPlaylistwithnullMediaMetadatadoes not reevaluate the metadata (#1940). - Change
SimpleBasePlayer.Stateaccess from protected to public to make it easier to handle updates in other classes(#2128).
- Add
- ExoPlayer:
- Add
MediaExtractorCompat, a new class that provides equivalent features to platformMediaExtractor. - Add experimental 'ExoPlayer' pre-warming support for playback using
MediaCodecVideoRenderer. You can configureDefaultRenderersFactorythroughexperimentalSetEnableMediaCodecVideoRendererPrewarmingto provide a secondaryMediaCodecVideoRenderertoExoPlayer. If enabled,ExoPlayerpre-processes the video of consecutive media items during playback to reduce media item transition latency. - Reduce default values for
bufferForPlaybackMsandbufferForPlaybackAfterRebufferMsinDefaultLoadControlto 1000 and 2000 ms respectively. - Initialize
DeviceInfoand device volume asynchronously (if enabled usingsetDeviceVolumeControlEnabled). These values aren't available instantly afterExoPlayer.Builder.build(), andPlayer.Listenernotifies changes throughonDeviceInfoChangedandonDeviceVolumeChanged. - Initial audio session id is no longer immediately available after creating the player. You can use
AnalyticsListener.onAudioSessionIdChangedto listen to the initial update if required. - Consider language when selecting a video track. By default, select a 'main' video track that matches the language of the selected audio track, if available. Explicit video language preferences can be expressed with
TrackSelectionParameters.Builder.setPreferredVideoLanguage(s). - Add
selectedAudioLanguageparameter toDefaultTrackSelector.selectVideoTrack()method. - Add
retryCountparameter toMediaSourceEventListener.onLoadStartedand correspondingMediaSourceEventListener.EventDispatchermethods. - Fix bug where playlist items or periods in multi-period DASH streams with durations that don't match the actual content could cause frame freezes at the end of the item (#1698).
- Move
BasePreloadManager.Listenerto a top-levelPreloadManagerListener. RenderersFactory.createSecondaryRenderercan be implemented to provide secondary renderers for pre-warming. Pre-warming enables quicker media item transitions during playback.- Enable sending
CmcdDatafor manifest requests in adaptive streaming formats DASH, HLS, and SmoothStreaming (#1951). - Provide
MediaCodecInfoof the codec that will be initialized inMediaCodecRenderer.onReadyToInitializeCodec(#1963). - Change
AdsMediaSourceto allow theAdPlaybackStatesto grow by appending ad groups. Invalid modifications are detected and throw an exception. - Fix issue where additional decode-only frames may be displayed in quick succession when transitioning to content media after a mid-roll ad.
- Make
DefaultRenderersFactoryadd twoMetadataRendererinstances to enable apps to receive two different schemes of metadata by default. - Reevaluate whether the ongoing load of a chunk should be cancelled when playback is paused (#1785).
- Add option to
ClippingMediaSourceto allow clipping in unseekable media. - Fix bug where seeking with pre-warming could block following media item transition.
- Fix a bug where
ExoPlayer.isLoading()remainstruewhile it has transitioned toSTATE_IDLEorSTATE_ENDED(#2133). - Add
lastRebufferRealtimeMstoLoadControl.Parameter(#2113).
- Add
- Transformer:
- Add support for transmuxing into alternative backward compatible formats.
- Add support for transcoding and transmuxing Dolby Vision (profile 8) format.
- Update parameters of
VideoFrameProcessor.registerInputStreamandVideoFrameProcessor.Listener.onInputStreamRegisteredto useFormat. - Generate HDR static metadata when using
DefaultEncoderFactory. - Enable support for Android platform diagnostics using
MediaMetricsManager. Transformer forwards editing 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 Transformer withTransformer.Builder.setUsePlatformDiagnostics(false). - Split
InAppMuxerintoInAppMp4MuxerandInAppFragmentedMp4Muxer. You useInAppMp4Muxerto produce a non-fragmented MP4 file, whileInAppFragmentedMp4Muxeris for producing a fragmented MP4 file. - Move
Muxerinterface frommedia3-muxertomedia3-transformer. - Add
MediaProjectionAssetLoader, which provides media from aMediaProjectionfor screen recording, and add support for screen recording to the Transformer demo app. - Add
#getInputFormat()toCodecinterface. - Shift the responsibility to release the
GlObjectsProvideronto the caller inDefaultVideoFrameProcessorandDefaultVideoCompositorwhen possible.
- Extractors:
- AVI: Fix handling of files with constant bitrate compressed audio where the stream header stores the number of bytes instead of the number of chunks.
- Fix handling of NAL units with lengths expressed in 1 or 2 bytes (rather than 4).
- Fix
ArrayIndexOutOfBoundsExceptionin MP4 edit lists when the edit list starts at a non-sync frame with no preceding sync frame (#2062). - Fix issue where TS streams can get stuck on some devices (#2069).
- FLAC: Add support for 32-bit FLAC files. Previously these would fail to play with
IllegalStateException: Playback stuck buffering and not loading(#2197).
- Audio:
- Fix
onAudioPositionAdvancingto be called when playback resumes (previously it was called when playback was paused). - Don't bypass
SonicAudioProcessorwhenSpeedChangingAudioProcessoris configured with default parameters. - Fix underflow in
Sonic#getOutputSize()that could causeDefaultAudioSinkto stall. - Fix
MediaCodecAudioRenderer.getDurationToProgressUs()andDecoderAudioRenderer.getDurationToProgressUs()so that seeks correctly reset the provided durations. - Make
androidx.media3.common.audio.SonicAudioProcessorfinal. - Add support for float PCM to
ChannelMappingAudioProcessorandTrimmingAudioProcessor.
- Fix
- Video:
- Change
MediaCodecVideoRenderer.shouldUsePlaceholderSurfaceto protected so that applications can override to block usage of placeholder surfaces (#1905). - Add experimental
ExoPlayerAV1 sample dependency parsing to speed up seeking. Enable it with the newDefaultRenderersFactory.experimentalSetParseAv1SampleDependenciesAPI. - Add experimental
ExoPlayerAPI to drop lateMediaCodecVideoRendererdecoder input buffers that are not depended on. Enable it withDefaultRenderersFactory.experimentalSetLateThresholdToDropDecoderInputUs. - Fix issue where a player without a surface was ready immediately and very slow decoding any pending frames (#1973).
- Exclude Xiaomi and OPPO devices from detached surface mode to avoid screen flickering (#2059).
- Change
- Text:
- Add support for VobSub subtitles (#8260).
- Stop eagerly loading all subtitle files configured with
MediaItem.Builder.setSubtitleConfigurations, and instead only load one if it is selected by track selection (#1721). - TTML: Add support for referencing
tts:originandtts:extentusingstyle(#2953). - Restrict WebVTT and SubRip timestamps to exactly 3 decimal places. Previously we incorrectly parsed any number of decimal places but always assumed the value was in milliseconds, leading to incorrect timestamp (#1997).
- Fix playback hanging when a playlist contains clipped items with CEA-608 or CEA-708 captions.
- Fix
IllegalStateExceptionwhen an SSA file contains a cue with zero duration (start and end time equal) (#2052). - Suppress (and log) subtitle parsing errors when subtitles are muxed into the same container as audio and vide (#2052).
- Fix handling of multi-byte UTF-8 characters in WebVTT files using CR line endings (#2167).
- DRM:
- Fix
MediaCodec$CryptoException: Operation not supported in this configurationerror when playing ClearKey content on API < 27 devices (#1732).
- Fix
- Effect:
- Moved the functionality of
OverlaySettingsintoStaticOverlaySettings.OverlaySettingscan be subclassed to allow dynamic overlay settings.
- Moved the functionality of
- Muxers:
- Moved
MuxerExceptionout ofMuxerinterface to avoid a very long fully qualified name. - Renamed
setSampleCopyEnabled()method tosetSampleCopyingEnabled()in bothMp4Muxer.BuilderandFragmentedMp4Muxer.Builder. Mp4Muxer.addTrack()andFragmentedMp4Muxer.addTrack()now return aninttrack ID instead of aTrackToken.Mp4MuxerandFragmentedMp4Muxerno longer implementMuxerinterface.- Disable
Mp4Muxersample batching and copying by default. - Fix a bug in
FragmentedMp4Muxerthat creates a lot of fragments when only audio track is written.
- Moved
- Session:
- Keep foreground service state for an additional 10 minutes when playback pauses, stops or fails. This allows users to resume playback within this timeout without risking foreground service restrictions on various devices. Note that simply calling
player.pause()can no longer be used to stop the foreground service beforestopSelf()when overridingonTaskRemoved, useMediaSessionService.pauseAllPlayersAndStopSelf()instead. - Keep notification visible when playback enters an error or stopped state. The notification is only removed if the playlist is cleared or the player is released.
- Improve handling of Android platform MediaSession actions ACTION_PLAY and ACTION_PAUSE to only set one of them according to the available commands and also accept if only one of them is set.
- Add
Contextas a parameter toMediaButtonReceiver.shouldStartForegroundService(#1887). - Fix bug where calling a
Playermethod on aMediaControllerconnected to a legacy session dropped changes from a pending update. - Make
MediaSession.setSessionActivity(PendingIntent)accept null (#2109). - Fix bug where a stale notification stays visible when the playlist is cleared (#2211).
- Keep foreground service state for an additional 10 minutes when playback pauses, stops or fails. This allows users to resume playback within this timeout without risking foreground service restrictions on various devices. Note that simply calling
- UI:
- Add state holders and composables to the
media3-ui-composemodule forPlayerSurface,PresentationState,PlayPauseButtonState,NextButtonState,PreviousButtonState,RepeatButtonState,ShuffleButtonStateandPlaybackSpeedState.
- Add state holders and composables to the
- Downloads:
- Fix bug in
CacheWriterthat leaves data sources open and cache areas locked in case the data source throws anExceptionother thanIOException(#9760).
- Fix bug in
- HLS extension:
- Add a first version of
HlsInterstitialsAdsLoader. The ads loader reads the HLS interstitials of an HLS media playlist and maps them to theAdPlaybackStatethat is passed to theAdsMediaSource. This initial version only supports HLS VOD streams withX-ASSET-URIattributes. - Add
HlsInterstitialsAdsLoader.AdsMediaSourceFactory. Apps can use it to createAdsMediaSourceinstances that use anHlsInterstitialsAdsLoaderin a convenient and safe way. - Parse
SUPPLEMENTAL-CODECStag from HLS playlist to detect Dolby Vision formats (#1785). - Loosen the condition for seeking to sync positions in an HLS stream (#2209).
- Add a first version of
- DASH extension:
- Add AC-4 Level-4 format support for DASH (#1898).
- Fix issue when calculating the update interval for ad insertion in multi-period live stream (#1698).
- Parse
scte214:supplementalCodecsattribute from DASH manifest to detect Dolby Vision formats (#1785). - Improve handling of period transitions in live streams where the period contains media samples beyond the declared period duration (#1698).
- Fix issue where adaptation sets marked with
adaptation-set-switchingbut different languages or role flags are merged together (#2222).
- Decoder extensions (FFmpeg, VP9, AV1, etc.):
- Add the MPEG-H decoder module which uses the native MPEG-H decoder module to decode MPEG-H audio (#1826).
- MIDI extension:
- Plumb custom
AudioSinkandAudioRendererEventListenerinstances intoMidiRenderer.
- Plumb custom
- Cast extension:
- Bump the
play-services-cast-frameworkdependency to 21.5.0 to fix aFLAG_MUTABLEcrash in apps targeting API 34+ on devices with Google Play services installed but disabled (#2178).
- Bump the
- Demo app:
- Extend
demo-composewith additional buttons and enhancePlayerSurfaceintegration with scaling and shutter support.
- Extend
- Remove deprecated symbols:
- Remove deprecated
AudioMixer.create()method. UseDefaultAudioMixer.Factory().create()instead. - Remove the following deprecated
Transformer.Buildermethods:setTransformationRequest(), usesetAudioMimeType(),setVideoMimeType(), andsetHdrMode()instead.setAudioProcessors(), set the audio processor in anEditedMediaItem.Builder.setEffects(), and pass it toTransformer.start()instead.setVideoEffects(), set video effect in anEditedMediaItem.Builder.setEffects(), and pass it toTransformer.start()instead.setRemoveAudio(), useEditedMediaItem.Builder.setRemoveAudio()to remove the audio from theEditedMediaItempassed toTransformer.start()instead.setRemoveVideo(), useEditedMediaItem.Builder.setRemoveVideo()to remove the video from theEditedMediaItempassed toTransformer.start()instead.setFlattenForSlowMotion(), useEditedMediaItem.Builder.setFlattenForSlowMotion()to flatten theEditedMediaItempassed toTransformer.start()instead.setListener(), useaddListener(),removeListener()orremoveAllListeners()instead.
- Remove the following deprecated
Transformer.Listenermethods:onTransformationCompleted(MediaItem), useonCompleted(Composition, ExportResult)instead.onTransformationCompleted(MediaItem, TransformationResult), useonCompleted(Composition, ExportResult)instead.onTransformationError(MediaItem, Exception), useonError(Composition, ExportResult, ExportException)instead.onTransformationError(MediaItem, TransformationException), useonError(Composition, ExportResult, ExportException)instead.onTransformationError(MediaItem, TransformationResult, TransformationException), useonError(Composition, ExportResult, ExportException)instead.onFallbackApplied(MediaItem, TransformationRequest, TransformationRequest), useonFallbackApplied(Composition, TransformationRequest, TransformationRequest)instead.
- Remove deprecated
TransformationResultclass. UseExportResultinstead. - Remove deprecated
TransformationExceptionclass. UseExportExceptioninstead. - Remove deprecated
Transformer.PROGRESS_STATE_NO_TRANSFORMATION. UseTransformer.PROGRESS_STATE_NOT_STARTEDinstead. - Remove deprecated
Transformer.setListener(). UseTransformer.addListener(),Transformer.removeListener()orTransformer.removeAllListeners()instead. - Remove deprecated
Transformer.startTransformation(). UseTransformer.start(MediaItem, String)instead. - Remove deprecated
SingleFrameGlShaderProgram. UseBaseGlShaderPrograminstead. - Remove
Transformer.flattenForSlowMotion. UseEditedMediaItem.flattenForSlowMotioninstead. - Removed
ExoPlayer.VideoComponent,ExoPlayer.AudioComponent,ExoPlayer.TextComponentandExoPlayer.DeviceComponent. - Removed
androidx.media3.exoplayer.audio.SonicAudioProcessor. - Removed the following deprecated
DownloadHelpermethods:- Constructor
DownloadHelper(MediaItem, @Nullable MediaSource, TrackSelectionParameters, RendererCapabilities[]), useDownloadHelper(MediaItem, @Nullable MediaSource, TrackSelectionParameters, RendererCapabilitiesList)instead. getRendererCapabilities(RenderersFactory), equivalent functionality can be achieved by creating aDefaultRendererCapabilitiesListwith aRenderersFactory, and callingDefaultRendererCapabilitiesList.getRendererCapabilities().
- Constructor
- Removed
PlayerNotificationManager.setMediaSessionToken(MediaSessionCompat)method. UsePlayerNotificationManager.setMediaSessionToken(MediaSession.Token)and pass in(MediaSession.Token) compatToken.getToken()instead.
- Remove deprecated