2023-06-29
·
136 commits
to main
since this release
Media3: v1.1.0
- Common Library:
- Add suppression reason for unsuitable audio route and play when ready change reason for suppressed too long. (#15).
- Add commands to Player:
COMMAND_GET_METADATACOMMAND_SET_PLAYLIST_METADATACOMMAND_SET_DEVICE_VOLUME_WITH_FLAGSCOMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS
- Add overloaded methods to Player which allow users to specify volume flags:
void setDeviceVolume(int, int)void increaseDeviceVolume(int)void decreaseDeviceVolume(int)void setDeviceMuted(boolean, int)
- Add
BuilderforDeviceInfoand deprecate existing constructor. - Add
DeviceInfo.routingControllerIdto specify the routing controller ID for remote playbacks. - Add
Player.replaceMediaItem(s)as a shortcut to adding and removing items at the same position (#8046).
- ExoPlayer:
- Allow ExoPlayer to have control of device volume methods only if explicitly opted in. Use
ExoPlayer.Builder.setDeviceVolumeControlEnabledto have access to:getDeviceVolume()isDeviceMuted()setDeviceVolume(int)andsetDeviceVolume(int, int)increaseDeviceVolume(int)andincreaseDeviceVolume(int, int)decreaseDeviceVolume(int)anddecreaseDeviceVolume(int, int)
- Add
FilteringMediaSourcethat allows to filter available track types from aMediaSource. - Add support for including Common Media Client Data (CMCD) in the outgoing requests of adaptive streaming formats DASH, HLS, and SmoothStreaming. The following fields,
br,bl,cid,rtp, andsid, have been incorporated (#8699). API structure and API methods:- CMCD logging is disabled by default, use
MediaSource.Factory.setCmcdConfigurationFactory(CmcdConfiguration.Factory cmcdConfigurationFactory)to enable it. - All keys are enabled by default, override
CmcdConfiguration.RequestConfig.isKeyAllowed(String key)to filter out which keys are logged. - Override
CmcdConfiguration.RequestConfig.getCustomData()to enable custom key logging.
- CMCD logging is disabled by default, use
- Add additional action to manifest of main demo to make it easier to start the demo app with a custom
*.exolist.jsonfile (#439). - Add
ExoPlayer.setVideoEffects()for usingEffectduring video playback. - Update
SampleQueueto storesourceIdas alongrather than anint. This changes the signatures of public methodsSampleQueue.sourceIdandSampleQueue.peekSourceId. - Add parameters to
LoadControlmethodsshouldStartPlaybackandonTracksSelectedthat allow associating these methods with the relevantMediaPeriod. - Change signature of
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. - Deprecate
EventDispatcher.withParameters(int windowIndex, @Nullable MediaPeriodId mediaPeriodId, long mediaTimeOffsetMs)andBaseMediaSource.createEventDispatcher(..., long mediaTimeOffsetMs). The variant of the methods without themediaTimeOffsetUscan be called instead. Note that even for the deprecated variants, the offset is not anymore added tostartTimeUsandendTimeUsof theMediaLoadDataobjects that are dispatched by the dispatcher. - Rename
ExoTrackSelection.blacklisttoexcludeTrackandisBlacklistedtoisTrackExcluded. - Fix inconsistent behavior between
ExoPlayer.setMediaItem(s)andaddMediaItem(s)when called on an empty playlist.
- Allow ExoPlayer to have control of device volume methods only if explicitly opted in. Use
- Transformer:
- Remove
Transformer.Builder.setMediaSourceFactory(MediaSource.Factory). UseExoPlayerAssetLoader.Factory(MediaSource.Factory)andTransformer.Builder.setAssetLoaderFactory(AssetLoader.Factory)instead. - Remove
Transformer.startTransformation(MediaItem, ParcelFileDescriptor). - Fix a bug where transformation could get stuck (leading to muxer timeout) if the end of the video stream was signaled at the moment when an input frame was pending processing.
- Query codecs via
MediaCodecListinstead of usingfindDecoder/EncoderForFormatutilities, to expand support. - Remove B-frame configuration in
DefaultEncoderFactorybecause it doesn't work on some devices.
- Remove
- Track selection:
- Add
DefaultTrackSelector.Parameters.allowInvalidateSelectionsForRendererCapabilitiesChangewhich is disabled by default. When enabled, theDefaultTrackSelectorwill trigger a new track selection when the renderer capabilities changed.
- Add
- Extractors:
- Audio:
- Fix bug where some playbacks fail when tunneling is enabled and
AudioProcessorsare active, e.g. for gapless trimming (#10847). - Encapsulate Opus frames in Ogg packets in direct playbacks (offload).
- Extrapolate current position during sleep with offload scheduling.
- Add
Renderer.release()andAudioSink.release()for releasing the resources at the end of player's lifecycle. - Listen to audio capabilities changes in
DefaultAudioSink. Add a required parametercontextin the constructor ofDefaultAudioSink, with which theDefaultAudioSinkwill register as the listener to theAudioCapabilitiesReceiverand update itsaudioCapabilitiesproperty when informed with a capabilities change. - Propagate audio capabilities changes via a new event
onAudioCapabilitiesChangedinAudioSink.Listenerinterface, and a new interfaceRendererCapabilities.Listenerwhich triggersonRendererCapabilitiesChangedevents. - Add
ChannelMixingAudioProcessorfor applying scaling/mixing to audio channels. - Add new int value
DISCARD_REASON_AUDIO_BYPASS_POSSIBLEtoDecoderDiscardReasonsto discard audio decoder when bypass mode is possible after audio capabilities change. - Add direct playback support for DTS Express and DTS:X (#335).
- Fix bug where some playbacks fail when tunneling is enabled and
- Video:
- Make
MediaCodecVideoRendererreport aVideoSizewith a width and height of 0 when the renderer is disabled.Player.Listener.onVideoSizeChangedis called accordingly whenPlayer.getVideoSize()changes. With this change, ExoPlayer's video size withMediaCodecVideoRendererhas a width and height of 0 whenPlayer.getCurrentTracksdoes not support video, or the size of the supported video track is not yet determined.
- Make
- DRM:
- Reduce the visibility of several internal-only methods on
DefaultDrmSessionthat aren't expected to be called from outside the DRM package:void onMediaDrmEvent(int)void provision()void onProvisionCompleted()onProvisionError(Exception, boolean)
- Reduce the visibility of several internal-only methods on
- Muxer:
- Add a new muxer library which can be used to create an MP4 container file.
- IMA extension:
- Enable multi-period live DASH streams for DAI. Please note that the current implementation does not yet support seeking in live streams (#10912).
- Fix a bug where a new ad group is inserted in live streams because the calculated content position in consecutive timelines varies slightly.
- Session:
- Add helper method
MediaSession.getControllerForCurrentRequestto obtain information about the controller that is currently calling aPlayermethod. - Add
androidx.media3.session.MediaButtonReceiverto enable apps to implement playback resumption with media button events sent by, for example, a Bluetooth headset (#167). - Add default implementation to
MediaSession.Callback.onAddMediaItemsto allow requestedMediaItemsto be passed ontoPlayerif they haveLocalConfiguration(e.g. URI) (#282). - Add "seek to previous" and "seek to next" command buttons on compact media notification view by default for Android 12 and below (#410).
- Add default implementation to
MediaSession.Callback.onAddMediaItemsto allow requestedMediaItemsto be passed ontoPlayerif they haveLocalConfiguration(e.g. URI) (#282). - Add "seek to previous" and "seek to next" command buttons on compact media notification view by default for Android 12 and below (#410).
- Add helper method
- UI:
- Add Util methods
shouldShowPlayButtonandhandlePlayPauseButtonActionto write custom UI elements with a play/pause button.
- Add Util methods
- RTSP Extension:
- DASH Extension:
- Remove the media time offset from
MediaLoadData.startTimeMsandMediaLoadData.endTimeMsfor multi period DASH streams. - Fix a bug where re-preparing a multi-period live Dash media source produced a
IndexOutOfBoundsException(#10838).
- Remove the media time offset from
- HLS Extension:
- Add
HlsMediaSource.Factory.setTimestampAdjusterInitializationTimeoutMs(long)to set a timeout for the loading thread to wait for theTimestampAdjusterto initialize. If the initialization doesn't complete before the timeout, aPlaybackExceptionis thrown to avoid the playback endless stalling. The timeout is set to zero by default (#323).
- Add
- Test Utilities:
- Check for URI scheme case insensitivity in
DataSourceContractTest.
- Check for URI scheme case insensitivity in
- Remove deprecated symbols:
- Remove
DefaultAudioSinkconstructors, useDefaultAudioSink.Builderinstead. - Remove
HlsMasterPlaylist, useHlsMultivariantPlaylistinstead. - Remove
Player.stop(boolean). UsePlayer.stop()andPlayer.clearMediaItems()(ifresetistrue) instead. - Remove two deprecated
SimpleCacheconstructors, use a non-deprecated constructor that takes aDatabaseProviderinstead for better performance. - Remove
DefaultBandwidthMeterconstructor, useDefaultBandwidthMeter.Builderinstead. - Remove
DefaultDrmSessionManagerconstructors, useDefaultDrmSessionManager.Builderinstead. - Remove two deprecated
HttpDataSource.InvalidResponseCodeExceptionconstructors, use a non-deprecated constructor that accepts additional fields(cause,responseBody) to enhance error logging. - Remove
DownloadHelper.forProgressive,DownloadHelper.forHls,DownloadHelper.forDash, andDownloadHelper.forSmoothStreaming, useDownloadHelper.forMediaIteminstead. - Remove deprecated
DownloadServiceconstructor, use a non deprecated constructor that includes the option to provide achannelDescriptionResourceIdparameter. - Remove deprecated String constants for Charsets (
ASCII_NAME,UTF8_NAME,ISO88591_NAME,UTF16_NAMEandUTF16LE_NAME), use Kotlin Charsets from thekotlin.textpackage, thejava.nio.charset.StandardCharsetsor thecom.google.common.base.Charsetsinstead. - Remove deprecated
WorkManagerSchedulerconstructor, use a non deprecated constructor that includes the option to provide aContextparameter instead. - Remove the deprecated methods
createVideoSampleFormat,createAudioSampleFormat,createContainerFormat, andcreateSampleFormat, which were used to instantiate theFormatclass. Instead useFormat.Builderfor creating instances ofFormat. - Remove the deprecated methods
copyWithMaxInputSize,copyWithSubsampleOffsetUs,copyWithLabel,copyWithManifestFormatInfo,copyWithGaplessInfo,copyWithFrameRate,copyWithDrmInitData,copyWithMetadata,copyWithBitrateandcopyWithVideoSize, useFormat.buildUpon()and setter methods instead. - Remove deprecated
ExoPlayer.retry(), useprepare()instead. - Remove deprecated zero-arg
DefaultTrackSelectorconstructor, useDefaultTrackSelector(Context)instead. - Remove deprecated
OfflineLicenseHelperconstructor, useOfflineLicenseHelper(DefaultDrmSessionManager, DrmSessionEventListener.EventDispatcher)instead. - Remove deprecated
DownloadManagerconstructor, use the constructor that takes anExecutorinstead. - Remove deprecated
Cueconstructors, useCue.Builderinstead. - Remove deprecated
OfflineLicenseHelperconstructor, useOfflineLicenseHelper(DefaultDrmSessionManager, DrmSessionEventListener.EventDispatcher)instead. - Remove four deprecated
AnalyticsListenermethods:onDecoderEnabled, useonAudioEnabledand/oronVideoEnabledinstead.onDecoderInitialized, useonAudioDecoderInitializedand/oronVideoDecoderInitializedinstead.onDecoderInputFormatChanged, useonAudioInputFormatChangedand/oronVideoInputFormatChangedinstead.onDecoderDisabled, useonAudioDisabledand/oronVideoDisabledinstead.
- Remove the deprecated
Player.Listener.onSeekProcessedandAnalyticsListener.onSeekProcessed, useonPositionDiscontinuitywithDISCONTINUITY_REASON_SEEKinstead. - Remove
ExoPlayer.setHandleWakeLock(boolean), usesetWakeMode(int)instead. - Remove deprecated
DefaultLoadControl.Builder.createDefaultLoadControl(), usebuild()instead. - Remove deprecated
MediaItem.PlaybackProperties, useMediaItem.LocalConfigurationinstead. Deprecated fieldMediaItem.playbackPropertiesis now of typeMediaItem.LocalConfiguration.
- Remove