When seeking in fMP4, we try to extract as little samples as possible
by only starting at the preceding sync frame. This comparison should
use <= to allow sync frames at exactly the seek position.
Issue: google/ExoPlayer#10941
PiperOrigin-RevId: 505098172
(cherry picked from commit 00436a04a4f0fec8ee9154fc1568ca4013ca5c7d)
MergingMediaPeriod creates its track groups with ids concatenating position in its periods array and the underlying child track group id. The ids can be used in selectTracks for matching to periods list.
Issue: google/ExoPlayer#10930
PiperOrigin-RevId: 505074653
(cherry picked from commit 542a1ef03f361b29ec731a7334b2922cb54ef4c9)
For most missing commands, we already disable the corresponding
controls. This change extends this to more UI elements that are
disabled in case the corresponding action is unavailable.
#minor-release
PiperOrigin-RevId: 505057751
(cherry picked from commit b3e7696ba7d66a2d3c477858194a20789f4d75c7)
The commands are partly checked already before enabling
features or calling player methods, but the checks were
still missing in many places.
#minor-release
PiperOrigin-RevId: 504589888
(cherry picked from commit e2ece2f5bcda0cea436d782d58fa6f1d9a4d1f99)
These attributes are required when importing our artifacts into
androidx-main in order to generate reference documentation (JavaDoc and
KDoc).
#minor-release
PiperOrigin-RevId: 504502555
(cherry picked from commit 47349b8c4bd69415da8895061be71ef748c4a2d3)
This allows a MediaController to understand which methods calls
are available on a legacy session.
PiperOrigin-RevId: 504306806
(cherry picked from commit 067340cb0a03dede0f51425de00643fe3789baf2)
ImaUtil calls VideoProgressUpdate.equals() which is annotated as hidden,
which causes lint errors with gradle.
#minor-release
PiperOrigin-RevId: 504306210
(cherry picked from commit 5f6e172c8fce652adf2c05e8f2d041c793e900ea)
Created unified MediaUtils method to handle various logic for calling Player.setMediaItems from MediaSessionStub and MediaSessionLegacyStub
PiperOrigin-RevId: 504271877
(cherry picked from commit 7fbdbeb6cafe075f04b6a4321ef826643b3482e1)
Added onSetMediaItems callback listener to allow the session to modify/set MediaItem list, starting index and position before call to Player.setMediaItem(s).
Added conditional check in MediaSessionStub.setMediaItem methods to only call player.setMediaItem rather than setMediaItems if player does not support COMMAND_CHANGE_MEDIA_ITEMS
PiperOrigin-RevId: 503427927
(cherry picked from commit bb11e0286eaa49b4178dfa29ebaea5dafba8fc39)
This makes it implicitly clear that if the value of a getter changes due
to a change in command availability then the listener will be invoked,
without needing to explicitly document every command on every listener
method.
#minor-release
PiperOrigin-RevId: 503178383
(cherry picked from commit 280889bc4a5b7ddc1b1c9fe15e222cad7f2e548a)
We stop estimating new position when pausing until we
receive a new position from the player. However, this
means that we will continue to return a possible stale
previous position. Updating the current position before
pausing solves this issue.
PiperOrigin-RevId: 503153982
(cherry picked from commit e961c1b5e9bb4a6f63458b1bdcb49e97f415fabf)
We currently only document it for the getCurrentMediaItem(), but
the command was always meant to cover all information about the
current media item and the position therein.
To correctly hide information for controllers, we need to filter
the Timeline when bundling the PlayerInfo class if only this
command is available.
PiperOrigin-RevId: 503098124
(cherry picked from commit f15b7525436b45694b5e1971dac922adff48b5ae)
When bundling PlayerInfo, we need to remove information if the
controller is not allowed to access it. This was only partially
done at the moment.
PiperOrigin-RevId: 502852798
(cherry picked from commit 69cfba7c53b563577390e4074fd270f078bf6069)
When bundling PlayerInfo, we remove data when the controller is not
allowed to access this data via getters. We also remove data for
performance reasons. In the toBundle() method, it's currently hard to
make the connection between allowed commands and filtering, because
the values are checked at a different place. This can be made more
readable by forwarding the applicable Commands directly.
The only functional fix is to filter the Timeline when sending the
first PlayerInfo after a connecting a controller if the command to
get the Timeline is not available. This also allows us to remove a
path to filter MediaItems from Timelines as it isn't used.
PiperOrigin-RevId: 502607391
(cherry picked from commit c90ca7ba5fb9e83956e9494a584ae6b0620e3b14)
PlayerWrapper advertises PlaybackStateCompat actions to the legacy
MediaSession based on the player's available commands.
PiperOrigin-RevId: 502559162
(cherry picked from commit 39f4a17ad4ac3863af22e12711247c7a87b8613e)
This player didn't fully check all player commands before calling the
respective methods.
PiperOrigin-RevId: 502353704
(cherry picked from commit a2a44cdc02abadd473e26e1fd9f973210d4c5f0e)
The method to dispatch actions in MediaControllerImplBase takes
a Player.Command, but the value is only used to check if we
are setting a surface and need to handle the special blocking
call. This can be cleaned up by removing the parameter and calling
a dedicated blocking method where needed. This also ensures we
have to mention the relevant Player.Command only once in each
method.
PiperOrigin-RevId: 502341862
(cherry picked from commit 664ab72d090196625b5f533e9f0a2112951c5741)
This avoids throwing exceptions for correct (but deprecated) Player
method invocations.
PiperOrigin-RevId: 502341428
(cherry picked from commit 86a95c2a4afd861986376f9dc31e0d65910e6e74)
This fix applies to Android 12 and above.
In this fix, the `MediaSessionService` will try to start in the foreground before the session playback resumes, if ForegroundServiceStartNotAllowedException is thrown, then the app can handle the exception with their customized implementation of MediaSessionService.Listener.onForegroundServiceStartNotAllowedException. If no exception thrown, the a media notification corresponding to paused state will be sent as the consequence of successfully starting in the foreground. And when the player actually resumes, another media notification corresponding to playing state will be sent.
PiperOrigin-RevId: 501803930
(cherry picked from commit 0d0cd786264aa82bf9301d4bcde6e5c78e332340)
This method allows to call through to `StreamManager.focus()` of the currently playing SSAI stream.
PiperOrigin-RevId: 501399144
(cherry picked from commit 16285ca5dfd4461334f5e97d4de47ae07e49e883)
Starting with Android 13 (API 33) an app needs to request the
permission to post notifications or notifications are suppressed.
This change documents this in the class level JavaDoc of the
`DownloadService`.
Issue: google/ExoPlayer#10884
PiperOrigin-RevId: 501346908
(cherry picked from commit 20aa5bd9263f594e4f1f8029c5b80e9f204bff3a)
Starting with API 33 the POST_NOTIFICATION permission needs to be
requested at runtime or the notification is not shown.
Note that with an app with targetSdkVersion < 33
but on a device with API 33 the notification permission is automatically
requested when the app starts for the first time. If the user does not
grant the permission, requesting the permission at runtime result in
an empty array of grant results.
Issue: google/ExoPlayer#10884
PiperOrigin-RevId: 501320632
(cherry picked from commit 6484c14acd4197d335cab0b5f2ab9d3eba8c2b39)
For TV devices the skip button needs to have the focus to be accessible with
the remote control. This property makes this configurable while being set to
true by default.
PiperOrigin-RevId: 501077608
(cherry picked from commit 9882a207836bdc089796bde7238f5357b0c23e76)
Initialising the fields as Integer and then getting a String on compute
time is slow. Instead we directly initialise these fields as String.
Improves the time taken in bundling PlayerInfo further to less than
200ms from ~300ms.
Also modified a test to improve productive coverage.
PiperOrigin-RevId: 500003935
(cherry picked from commit 578f2de48f795ad90aafdad645c62fcdbd686e0a)
As per the javadoc for AtomParsers.parseTrack, ParserException should be "thrown if the trak atom can't be parsed."
PiperOrigin-RevId: 499522748
(cherry picked from commit d8ea770e9ba6eed0bdce0b359c54a55be0844fd3)
Improves the time taken to construct playerInfo from its bundle from ~400 ms to ~300 ms.
Also made `Timeline.Window.toBundle(boolean excludeMediaItem)` public as it was required to assert a condition in tests.
PiperOrigin-RevId: 499512353
(cherry picked from commit 790e27d929906a36438af5b42ef62a13e4719045)
Added another check in each of these tests to make sure we don't add keys to bundle for fields with default values.
Also fixed comments of similar changes in `AdPlaybackStateTest` and `MediaMetadataTest`.
PiperOrigin-RevId: 499463581
(cherry picked from commit 0512164fdd570a2047f51be719aae75ebcbf9255)
We might as well keep this enabled by default, rather than having to
manually toggle it on to investigate RTL issues like Issue: androidx/media#227.
PiperOrigin-RevId: 497159744
(cherry picked from commit 69583d0ac1fa1ab1a1e250774fc1414550625967)
Did not do this optimisation for `AdPlaybackState.AdGroup` as its length is zero for `AdPlaybackState` with no ads.
No need to pass default values while fetching keys, which we always set in `AdPlaybackState.AdGroup.toBundle()`.
PiperOrigin-RevId: 496995048
(cherry picked from commit 7fc2cdbe1bdf9968a1e73a670e5e32454090e1bd)
Added another check in test to make sure we don't add keys to bundle for fields with `null` values.
PiperOrigin-RevId: 496948705
(cherry picked from commit 13c93a3dd693e86e6d5208aff45105000858363f)
There are two overloads of this method due to a type 'rename' from
`PlayerControlView.VisibilityListener` to
`PlayerView.ControllerVisibilityListener`. Currently when you call one
overload it passes `null` to the other one (to clear the other listener).
Unfortunately this results in it clearing itself, because it receives
a null call back!
This change tweaks the documentation to clarify that the 'other'
listener is only cleared if you pass a non-null listener in. This solves
the recursive problem, and allows the 'legacy' visibility listener to be
successfully registered.
Issue: androidx/media#229
#minor-release
PiperOrigin-RevId: 496876397
(cherry picked from commit 4087a011e21aba2c27e3ae890f74a65812c6f4ce)