- Common Library:
- Add
C.COLOR_SPACE_DISPLAY_P3and support Display P3 color space inMediaFormatUtilandColorInfoISO color mappings. - Add a central
Flagsregistry to manage experimental feature flags and staged rollout (Flags.setCanaryModeEnabled). Migrated many existing@ExperimentalApimethods to use the new flags API. - Add
MediaMetadata.playlistId,MediaMetadata.Builder.setPlaylistId(String),MediaMetadata.categories, andMediaMetadata.Builder.setCategories(List<String>). - Replace
androidx.media3.common.util.NonNullApiwith JSpecifyorg.jspecify.annotations.NullMarked.
- Add
- ExoPlayer:
- Fix an issue where DASH multi-period playback gets stuck when the next period's first chunk fails to load (#3396).
- Report
wasCanceled = trueinAnalyticsListener.onLoadErrorandMediaSourceEventListener.onLoadErrorwhen load retries are exhausted. - Support registering multiple
VideoFrameMetadataListenerinstances usingExoPlayer.addVideoFrameMetadataListenerandExoPlayer.removeVideoFrameMetadataListener, deprecatingExoPlayer.setVideoFrameMetadataListenerandExoPlayer.clearVideoFrameMetadataListener. - Add support for ads in multi-period content (e.g., DASH) by splitting and offsetting the
AdPlaybackStatefor each period. - Fix race condition in
PreCacheHelperwhere canceling an ongoing preparation request could still start background downloads. - Limit
setLoadOnlySelectedTracks(true)onProgressiveMediaSourceandDefaultMediaSourceFactoryto only filter out unselected video and image tracks. Audio and text tracks are always loaded to allow seamless track switching without re-buffering. - Enable
setLoadOnlySelectedTracks(true)by default onProgressiveMediaSourceandDefaultMediaSourceFactory. This saves memory and allowsDefaultLoadControlbuffer allocation calculations to work more accurately when not all tracks are selected. Note that this may cause additional buffering if unselected video or image tracks are newly enabled mid-playback. - Fix an issue where
Player.getCurrentPosition()could return stale values (updating only a few times per second) when dynamic scheduling is enabled (#3286). - Fix an issue where an unexpected decrease or reset in the
AudioTrackplayback head position could be incorrectly treated as an integer overflow, causing playback to stall in buffering (#3407). - Remove experimental
DefaultMediaCodecAdapterFactory.setAsyncCryptoSynchronizationEnabled(boolean). - Avoid unnecessary renderer re-enables and glitches when returning from interstitials or ads into content clipped at the end (#3371).
- Fix an issue where a renderer error on an upcoming playlist item could prematurely interrupt current playback when
Flags.FLAG_PER_STREAM_MEDIA_PROGRESSIONis enabled. - Fix a
NullPointerExceptionthat could occur ifExoPlayertransitioned renderers to an unprepared media period whenFlags.FLAG_PER_STREAM_MEDIA_PROGRESSIONis enabled. - Fix an issue where video frames could be unexpectedly skipped or dropped during dynamic scheduling when
Flags.FLAG_VIDEO_RENDERER_DURATION_TO_PROGRESSis enabled. - Fix an
ArrayIndexOutOfBoundsExceptionin analytics listeners when stopping playback during an ad on a livestream (#3423). - Fix an issue where
PreloadMediaSourcecould unexpectedly post preload event whenpreload()is never called (#3408). - Fix an issue where
Format.subsampleOffsetUswas ignored for metadata tracks, causing incorrect playback timestamps in decoded SCTE-35 splice commands (#3413). - Fix a memory leak in
PreloadMediaSourceandDefaultPreloadManagerwhenpreload()is called multiple times on the same source (#3445). - Fix a
NullPointerExceptionwhen releasingAdsMediaSourcewhile a content timeline refresh is pending (#3442). - Fix an issue where playback of progressive media could jump to the wrong position when a load after a seek (or when starting playback at a non-zero position) failed and was retried (#3440).
- Add workaround for the Xiaomi TV Stick 4K (MiTV-AYFR0) H.264 decoder freezing on seamless resolution changes (#3457).
- Fix a
NullPointerExceptioninSteeringManifestTrackerwhen the tracker is stopped before a posted load completion or error callback is executed (#3443). - Support HAGC (ST 2094-50) timed metadata playback from
mebxboxed metadata tracks in MP4 files. - Fix an issue where slow-preparing media periods in a playlist could be skipped.
- CompositionPlayer:
- Support configuring the frame rate of video frame aggregation using
Composition.Builder.setVideoFrameAggregationParametersfor playback workflows. - Fix frame drops in multi-sequence compositions caused by timestamp quantization or rounding mismatches, by selecting the frame with the closest timestamp during frame aggregation. This is enabled from API 29 only, as it requires holding one additional frame in flight per video sequence.
- Support configuring the frame rate of video frame aggregation using
- Transformer:
- Support configuring the frame rate of video frame aggregation using
Composition.Builder.setVideoFrameAggregationParametersfor export workflows. - Fix frame drops in multi-sequence compositions caused by timestamp quantization or rounding mismatches, by selecting the frame with the closest timestamp during frame aggregation. This is enabled from API 29 only, as it requires holding one additional frame in flight per video sequence.
- Respect
Transformer#setAudioMimeType(AUDIO_RAW)whenAudioProcessorsare used. Prior to this fix, requestingMimeTypes.AUDIO_RAWand applying anAudioProcessorresulted in compressed output.
- Support configuring the frame rate of video frame aggregation using
- Track Selection:
- Fix an issue where an SDR track was incorrectly preferred over a supported Dolby Vision track on some devices (#3135).
- Extractors:
- Mp4Extractor: Fix
dOpsbox parsing for Opus in MP4 wherePreSkip,InputSampleRate, andOutputGainwere not converted from big-endian to little-endian, causing the first ~299 ms of audio to be dropped when no edit list is present (#3431). - Remove
Mp4Extractor.FLAG_READ_WITHIN_GOP_SAMPLE_DEPENDENCIES,Mp4Extractor.FLAG_READ_WITHIN_GOP_SAMPLE_DEPENDENCIES_H265,FragmentedMp4Extractor.FLAG_READ_WITHIN_GOP_SAMPLE_DEPENDENCIES, andFragmentedMp4Extractor.FLAG_READ_WITHIN_GOP_SAMPLE_DEPENDENCIES_H265as within-GOP sample dependency parsing for H.264 and H.265 is enabled by default. - Mp4Extractor: Fix location metadata parsing from
xyzboxes containing altitude coordinates to populateMp4LocationData. - Add
ExtractorUtil.getFramesPerEncodedSampleto calculate the number of audio frames per sample for encoded audio formats (#3367). - Add
FLAG_READ_XMP_METADATAtoMp4Extractorto extract XMP metadata from top-level UUID boxes. - Fix corrupted AC-3, DTS and LPCM audio when playing DVD-style MPEG-PS content, by stripping the
private_stream_1sub-stream header from each PES packet inPsExtractorbefore the payload is passed to the audio reader (#3327). - Fix failure in
FragmentedMp4Extractorwhen a version 1tfdtbox encodes a negativebaseMediaDecodeTime(#3412). - MPEG-TS: Support parsing H.264 and H.265 frame packing arrangement SEI messages to populate
Format.stereoMode(#3419). - Parse Dolby Vision Profile 20 configuration data and reject unsupported Dolby Vision profiles instead of playing back as standard HEVC with incorrect colors (#3427).
- MP3: Revert LAME/Xing encoder delay & padding metadata adjustment because it's incompatible with many
MediaCodecMP3 decoders (#3425). - Matroska: Fix
NullPointerExceptionwhen parsing nestedChapterAtomelements (#3438). - Ogg: Fix bug where a packet whose size is a multiple of 255 bytes and ends at a page boundary is merged with the following packet.
- MP4: Parse
mebxboxed timed metadata tracks inMp4ExtractorandFragmentedMp4Extractor. Tracks carrying anit35key are exposed asMimeTypes.APPLICATION_ITUT_T35(enabling HAGC playback). Othermebxtracks are ignored unlessFLAG_EMIT_RAW_MEBX_DATAis set, in which case allmebxtracks are emitted as rawMimeTypes.APPLICATION_MEBX. - Ogg: Support extracting Opus end-padding for gapless playback (#2576), and fix sample timestamps after seeking to a page that starts with a continued packet.
- Ogg: Fix decode errors and ~1s timestamp jumps in chained Ogg Opus streams by ignoring mid-stream Opus ID and comment header packets.
- Mp4Extractor: Fix
- Inspector:
- Support retrieving XMP metadata from MP4 files using
MetadataRetriever. - Support extracting
mebxboxed timed metadata tracks inMediaExtractorCompatasMimeTypes.APPLICATION_MEBX.
- Support retrieving XMP metadata from MP4 files using
- Inspector Frame:
- Fix clipping of wide-gamut BT.2020 colors in the SDR base image when extracting Ultra HDR frames with
FrameExtractor. Out-of-gamut colors are now softly compressed into the sRGB gamut instead of being clamped.
- Fix clipping of wide-gamut BT.2020 colors in the SDR base image when extracting Ultra HDR frames with
- Audio:
- Add workaround for devices that invoke
android.media.AudioDeviceCallbackon the wrong thread (#3386). - Fix potential stuck playbacks after track transitions with compressed offload.
- Work around an issue on Amazon Fire TV sticks where AC-3 audio could freeze during period transitions (#3448).
- Support trimming end-of-stream encoder padding for Ogg and WebM/Matroska Opus gapless playback (#2576).
- Fix dynamic offload gapless delay and padding updates during track transitions so they apply to the incoming track rather than the playing track.
- Trim encoder end-padding on single streams and the final stream in a playlist in addition to mid-playlist gapless transitions (#2576).
- Avoid unnecessary audio buffer copies in
TrimmingAudioProcessorafter start-of-stream encoder delay trimming has completed and no end-of-stream padding needs to be trimmed.
- Add workaround for devices that invoke
- Video:
- Fix reporting of late video frames with identical release timestamps so that they are reported as dropped instead of skipped.
- Text:
- Add
MediaItem.SubtitleConfiguration.timeOffsetUsto shift the timestamps of sideloaded subtitles relative to the media. The offset can be changed during playback withPlayer.replaceMediaItem(int, MediaItem)without interrupting playback (#1976). - SubRip: Add support for injecting a
CharsetDetectorintoDefaultSubtitleParserFactoryto detect the character encoding of standalone SubRip subtitles without a byte order mark (#2247).
- Add
- Effect:
- Implement
SoundSeparationAudioProcessorfor audio source separation using StudioSound GMSCore module.
- Implement
- Muxers:
- Fix
dOpsbox writing for Opus inMp4MuxerandFragmentedMp4MuxerwherePreSkip,InputSampleRate, andOutputGainwere written in little-endian instead of big-endian (#3431). - Support writing GPS altitude in
Mp4LocationDatausingMp4Muxer. - Add
Muxer.Factory.create(ParcelFileDescriptor)to allow muxing directly to aParcelFileDescriptor. - Write
tfdt(Track Fragment Base Media Decode Time) box by default intrafboxes of fragmented MP4 files to provide media decode timestamps. - Support writing E-AC-3 and E-AC-3 JOC (Dolby Atmos)
dec3container boxes inMp4Muxer. - Add WebM format support to
MediaMuxerCompat. - Write
mfra(Movie Fragment Random Access) box at the end of fragmented MP4 files to allow seeking inFragmentedMp4ExtractorusingFLAG_READ_MFRA_FOR_SEEK_MAP. - Fix crash in
Mp4WriterandFragmentedMp4Writerwhen writing an EOS sample before any other samples are written. - Fix container compliance when muxing Dolby content into MP4 or Fragmented MP4 files by advertising the
dby1compatible brand in the container header (#3369). - Support 32-bit float PCM audio tracks in
Mp4MuxerandFragmentedMp4Muxer(#3389). - Reject unsupported Dolby Vision profiles in
Mp4MuxerandFragmentedMp4Muxerwhen adding tracks. - Support 24-bit and 32-bit integer PCM audio tracks in
Mp4MuxerandFragmentedMp4Muxer.
- Fix
- IMA extension:
- Forward player pause and resume events to the IMA SDK in
ImaServerSideAdInsertionMediaSource.
- Forward player pause and resume events to the IMA SDK in
- Session:
- Add
MediaConstants.EXTRAS_KEY_PLAYLIST_ID,MediaConstants.EXTRAS_KEY_PLAYLIST_TITLE,MediaConstants.EXTRAS_KEY_PLAYLIST_ARTWORK_URI, andMediaConstants.EXTRAS_KEY_CATEGORIESto populate playlist and item metadata from legacy metadata and descriptions, andMediaConstants.EXTRAS_KEY_SUGGESTED_TYPEandMediaConstants.EXTRAS_KEY_TTL_SECONDSfor suggestionLibraryParams.extras. - Fix
SecurityExceptioncrash when creating or releasing aMediaSessionon devices that enforce strictPendingIntentlimits. - Fix issue where
MediaSession.getControllerForCurrentRequest()returnednullduring play requests on Android 12 (API 31 and 32) whenMediaSessionServicewas not yet in the foreground. - Fix
IllegalArgumentExceptioncrash when aMediaControllerconnects to a legacy session that reports a negative maximum volume. - Fix an issue where calling
MediaController.setMediaItemorsetMediaItemsfollowed byplay()on a paused legacyMediaSessionCompatcould dispatch an unsupportedonPrepareFrom*callback instead ofonPlayFrom*, or dispatchonPlay()without re-initializing the requested media item. - Fix
NullPointerExceptionin legacyMediaBrowserwhen receiving a custom command response (#3432). - Fix
IllegalArgumentExceptioncrash when receiving legacy metadata with duplicate keys in its underlyingBundle. - Coalesce outgoing
MediaControllerCompat.TransportControlscalls made within the sameLooperiteration when controlling a legacyMediaSessionCompat(for example, callingsetMediaItem,prepare, andplaytogether now dispatches a singleonPlayFrom*callback).
- Add
- UI:
- Fix RTL subtitle punctuation positioning and span range preservation when bidirectional text wrapping is enabled (#3454, #3455).
- Add
TrackSelectionStateandTrackSelectionParametersStateclasses and their corresponding Composable state remember functions to themedia3-ui-composemodule. - Introduce
PresentationState.videoAspectRatioand makeModifier.resizeWithContentScaletakeaspectRatio: Float?instead ofsourceSizeDp: Size?. - Add
CuesStateclass andrememberCuesStateComposable to themedia3-ui-composemodule for listening to player's current cues. - Add scrubbing mode support to
ProgressSliderif it is based onExoPlayerorCompositionPlayer. - Add
showArtworksupport toPresentationStateand use it to time rendering of the provided optionalartworkComposable inContentFrameandPlayer. AddArtworkComposable to be used as the default value for theartworkslot. - Add new fields to
PlayPauseButtonState(showBuffering,showRetry,showReplay) and use them inPlayPauseButtonto render more icons and a buffering indicator. - Add
PlaybackStateclass to allow custom playback state observation, and introduceBufferingIndicatoras a button-independent component. - Fix an issue where
PlayerViewandPlayerControlViewshowed ad markers at period boundaries for live postroll placeholders in multi-period livestreams. - Composable slots of
Player,ContentFrame,PlayerDefaultsandMiniControllerno longer receive the player or the controls visibility as parameters. Capture them from the calling scope instead (for example,topControlsis now@Composable BoxScope.() -> Unit). This is a breaking change on an unstable API. - Add
alignmentparameter toContentFrame,PlayerandModifier.resizeWithContentScaleto position the scaled content within its container, and clip the content ofContentFrameto its bounds, so that video scaled withContentScale.Cropno longer draws outside it. - Add livestream UI support to
ProgressSlider,ProgressStateWithTickCountandProgressStateWithTickIntervalby exposingisLiveandliveOffsetMs. AddLiveButtonComposable tomedia3-ui-compose-material3(#2213).
- Ktor extension:
- Fix an issue where
KtorDataSourcecould treat mid-stream connection failures as end-of-input instead of throwing anHttpDataSourceException(#3460).
- Fix an issue where
- HLS extension:
- Parse
VIDEO-RANGE(PQandHLG) onEXT-X-STREAM-INFandEXT-X-I-FRAME-STREAM-INFintoFormat.colorInfo(#3441). - Fix
NullPointerExceptionwhen parsing MPEG-TSEXT-X-MAPinitialization segments that contain PES media samples (#3456). - Fix regression where
Format.idandFormat.metadatawerenullfor exposed HLS tracks (#3402). - Clip asset-list ads to
X-PLAYOUT-LIMITand skip those that fall entirely past the limit, and default the content resume offset to 0 when an interstitial omitsX-RESUME-OFFSETand its duration is unknown even ifX-PLAYOUT-LIMITis set. - Fix an issue where resolving an
X-ASSET-LISTinterstitial overwrote the content resume offset contributions of other interstitials in the same ad group.
- Parse
- DASH extension:
- Support parsing Alternative MPD Insertion (
urn:mpeg:dash:event:alternativeMPD:insert:2025) and Replacement (urn:mpeg:dash:event:alternativeMPD:replace:2025) events inDashManifestParserand expose them asAlternativeMpdEventinstances inPeriod.alternativeMpdEvents. This is a breaking change for apps that subclassDashManifestParser:DashManifestParser.buildPeriodnow takes an additionalList<AlternativeMpdEvent>parameter and the previous overload has been removed. Apps overridingDashManifestParser.parseEventStream(XmlPullParser)must overrideDashManifestParser.parseEventStream(XmlPullParser, String)instead, as the former is deprecated and will be made private in a future release. - Parse CICP color information (
ColourPrimaries,TransferCharacteristics,MatrixCoefficients, andVideoFullRangeFlag) fromEssentialPropertyandSupplementalPropertydescriptors intoFormat.colorInfo(#3426). - Support whitespace-separated lists of
@idvalues in trick mode (http://dashif.org/guidelines/trickmode) descriptor@valueattributes (#3315). - Support parsing
<ProducerReferenceTime>inDashManifestParser, exposing it inAdaptationSet.producerReferenceTimes, and using it to populateTimeline.Window.presentationStartTimeMsandTimeline.Window.windowStartTimeMsfor VOD streams. - Add support for DASH Content Steering (#1689).
- Fix a
NullPointerExceptionthat could occur when parsing a DASH manifest with a missing attribute in<UTCTiming>element (#3436).
- Support parsing Alternative MPD Insertion (
- RTSP extension:
- Fix an
IllegalStateExceptioncrash that occurred when processing delayed network responses after the RTSP client was closed. - Fix issue where rapid scrubbing could incorrectly trigger the TCP protocol fallback mechanic.
- Fix an
IllegalStateExceptioncrash that can occur when processing delayed network responses after the RTSP client resets state during track reselection, session teardown, or uri redirection. - Fix issue where seeking again prior to playback restart could cause an
IllegalStateExceptioncrash. - Fix issue where seeking backward while a seek is already pending could cause audio dropout and video playback freeze.
- Fix an issue where H.264 and H.265 keyframe access units ending with an aggregation or non-IDR packet were not flagged as keyframes, causing playback to remain stuck in buffering (#3434).
- Fix an
- Decoder extensions (FFmpeg, VP9, AV1, etc.):
- Opus extension: Fix JNI crash when decoding invalid Opus data.
- Opus extension: Fix discard padding being ignored when pre-skip and discard padding fall on the same packet (#2576).
- Cast extension:
- Introduce
SessionAvailabilityListener.SessionUnavailableReasonto represent the reason for session unavailability, and provide an overloaded method forSessionAvailabilityListener.onCastSessionUnavailableto expose it. - Fix an issue where playback would unexpectedly resume locally after stopping a Cast session.
- Log an error when
RemoteMediaClientoperations (such as play, pause, speed change, repeat mode, volume, mute, or track selection) fail inRemoteCastPlayer(#3373). - Fix
ArrayIndexOutOfBoundsExceptioninRemoteCastPlayerwhen the Cast receiver queue changes or shrinks while a seek operation is pending (#3372). - Fix an issue with the default Cast receiver where the timeline only populated media items immediately surrounding the active item rather than the entire playlist (#3129).
- Update the timeline and playback position immediately when modifying the playlist (
setMediaItems,addMediaItems,moveMediaItems,removeMediaItems) or seeking inRemoteCastPlayer, and queue successive playlist operations so they execute reliably in order (#2639, #3272). - Fix an issue where calling
addMediaItemson an empty queue inRemoteCastPlayerfailed to load the media items on the Cast receiver (#2402). - Fix an issue in
RemoteCastPlayerwhere reaching the end of the Cast receiver queue cleared the timeline instead of retaining the playlist. - Fix an issue where
playWhenReady,repeatMode, andplaybackParameterswere not transferred or applied when set onRemoteCastPlayerbefore loading media items (for example, during local-to-remote playback transfer inCastPlayer) (#889).
- Introduce
- Demo app:
- Add support for DRM-protected media items and an additional HLS sample stream to the session demo app catalog.
- Configure
RemoteCastPlayerwith aCastTrackSelectorin the session demo app to enable subtitle and audio track selection while casting.
- Remove deprecated symbols:
- Remove
DashUtil.buildDataSpec(Representation, RangedUri, int)andDashUtil.buildDataSpec(Representation, String, RangedUri, int). UseDashUtil.buildDataSpec(Representation, BaseUrl, RangedUri, int, Map<String, String>)instead.
- Remove
- Build:
- Increase Gradle
minSdkto 24.
- Increase Gradle