15073 Commits

Author SHA1 Message Date
christosts
f17e846d3d
Merge pull request #251 from androidx/release-1.0.0-rc01
1.0.0 rc01
1.0.0-rc01
2023-02-16 17:03:01 +00:00
christosts
98bf30d2af Version bump for ExoPlayer 2.18.3 & media3-1.0.0-rc01
#minor-release

PiperOrigin-RevId: 509501665
(cherry picked from commit 20eae0e041e1922fd79ca36218054b293a9da7da)
2023-02-14 18:52:54 +00:00
christosts
9f432499fb Minor fixes in release notes
PiperOrigin-RevId: 509222489
(cherry picked from commit a90728fdc66cc2a8929cce9d67081681e0168115)
2023-02-14 18:52:51 +00:00
christosts
3fdaf78fc4 Prepare media3 release notes for rc01
PiperOrigin-RevId: 509218510
(cherry picked from commit 73909222706c6d7a56e0fb2d09ed8b49eca5b2be)
2023-02-14 18:49:26 +00:00
christosts
f983d912e5 Fix release note entry 2023-02-02 16:49:56 +00:00
christosts
9bf18dbb4e Session: advertise legacy FLAG_HANDLES_QUEUE_COMMANDS
This change includes 3 things:
- when the legacy media session is created, FLAG_HANDLES_QUEUE_COMMANDS
  is advertised if the player has the COMMAND_CHANGE_MEDIA_ITEMS
  available.
- when the player changes its available commands, a new
  PlaybackStateCompat is sent to the remote media controller to
  advertise the updated PlyabackStateCompat actions.
- when the player changes its available commands, the legacy media
  session flags are sent accoridingly: FLAG_HANDLES_QUEUE_COMMANDS is
  set only if the COMMAND_CHANGE_MEDIA_ITEMS is available.

#minor-release

PiperOrigin-RevId: 506605905
(cherry picked from commit ebe7ece1eb7e2106bc9fff02db2666410d3e0aa8)
2023-02-02 16:47:10 +00:00
bachinger
065418cc28 Publish ConcatenatingMediaSource2
Can be used to combine multiple media items into a single timeline window.

Issue: androidx/media#247
Issue: google/ExoPlayer#4868
PiperOrigin-RevId: 506283307
(cherry picked from commit fcd3af6431cfcd79a3ee3cc4fee38e8db3c0554e)
2023-02-02 16:47:09 +00:00
christosts
d49bd456b6 Merge pull request #10793 from fraunhoferfokus:dash-thumbnail-support
PiperOrigin-RevId: 506261584
(cherry picked from commit c6569a36fbce6fc3ece55c9a904508bd4a4c45da)
2023-02-02 16:47:09 +00:00
ibaker
791c05b57a Fix (another) LeanbackPlayerAdapter param name mismatch
I missed this when fixing `positionInMs` for Dackka in aae6941981

This time I manually verified that all the `@Override` methods have
parameter names that match [the docs](https://developer.android.com/reference/androidx/leanback/media/PlayerAdapter).

#minor-release

PiperOrigin-RevId: 506017063
(cherry picked from commit d1a27bf2a81709bc7b03ad130bc9abd4d8b27164)
2023-02-02 13:22:39 +00:00
bachinger
5528baaad9 Do not assume a valid queue in 3rd party sessions
This change fixes an issue that can be reproduced when
a controller `onConnect` creates a `QueueTimeline` out
of the state of a legacy session and then `prepare` is called.

`activeQueueItemId`, `metadata` and the `queue` of the legacy
session are used when a `QueueTimeline` is created. The change
adds unit tests to cover the different combinatoric cases these
properties being set or unset.

PiperOrigin-RevId: 505731288
(cherry picked from commit 4a9cf7d069b1b35be807886d59d87c396b19876c)
2023-02-02 13:22:38 +00:00
bachinger
bfc4ed4dd4 Inline method in PlayerService that is used from on call site only
#cleanup
#minor-release

PiperOrigin-RevId: 505146915
(cherry picked from commit d7ef1ab5bd5a4508c0913011f5990bb03a57585a)
2023-02-02 13:22:38 +00:00
tonihei
631ff809f5 Fix timestamp comparison for seeks in fMP4
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)
2023-02-02 13:22:33 +00:00
bachinger
bcdedb719d Double tap detection for Bluetooth media button events only
Issue: androidx/media#233
#minor-release
PiperOrigin-RevId: 505078751
(cherry picked from commit 5c82d6bc18429842160bb64a851bb1ab5c89ec39)
2023-02-02 13:18:30 +00:00
michaelkatz
c37442b24d Match MergingMediaPeriod track selection by period index in id
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)
2023-02-02 13:18:30 +00:00
tonihei
5e6f79ae63 Tweak UI behavior when commands are missing.
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)
2023-02-02 13:18:29 +00:00
tonihei
55312e1257 Add missing command checks in UI module
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)
2023-01-26 14:26:00 +00:00
ibaker
d6c9fdb210 Add missing } to publish.gradle
This was missed in 47349b8c4b

#minor-release

PiperOrigin-RevId: 504548659
(cherry picked from commit 50beec56f4188e46f67e561ac4bb4ace5bb95089)
2023-01-26 14:26:00 +00:00
ibaker
3708e7529a Publish gradle attributes for AndroidX compatibility
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)
2023-01-26 14:26:00 +00:00
tonihei
c357e67dd1 Filter available commands based on PlaybackStateCompat actions
This allows a MediaController to understand which methods calls
are available on a legacy session.

PiperOrigin-RevId: 504306806
(cherry picked from commit 067340cb0a03dede0f51425de00643fe3789baf2)
2023-01-26 14:26:00 +00:00
christosts
207d67b7af Suppress warnings in ImaUtil
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)
2023-01-26 14:26:00 +00:00
michaelkatz
846258b69c Deduplicate onSetMediaItem handler logic
Created unified MediaUtils method to handle various logic for calling Player.setMediaItems from MediaSessionStub and MediaSessionLegacyStub

PiperOrigin-RevId: 504271877
(cherry picked from commit 7fbdbeb6cafe075f04b6a4321ef826643b3482e1)
2023-01-26 14:26:00 +00:00
christosts
2adcfd9b15 Add missing # in release notes
PiperOrigin-RevId: 504013985
(cherry picked from commit 5147011772286778e84410012a24e329fde12040)
2023-01-26 14:25:34 +00:00
michaelkatz
e266051fbe Add onSetMediaItems listener with access to start index and position
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)
2023-01-25 18:18:42 +00:00
bachinger
107a481356 Add the MediaSession as an argument to getMediaButtons()
Issue: androidx/media#216
#minor-release
PiperOrigin-RevId: 503406474
(cherry picked from commit e690802e9ecf96dfbb972864819a45ae92c47c90)
2023-01-25 18:18:42 +00:00
ibaker
967224c1aa Explicitly document most Player.Listener methods in terms of getters
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)
2023-01-25 18:18:42 +00:00
tonihei
43677b95eb Add command check for metadata in DefaultMediaNotificationProvider
PiperOrigin-RevId: 503172986
(cherry picked from commit 052c4b3c1a6b72efd7fcbf433c646fed9ea91748)
2023-01-25 18:18:42 +00:00
tonihei
28e37808ed Update media controller position before pausing.
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)
2023-01-25 18:18:42 +00:00
tonihei
5b18c2d89f Extend command GET_CURRENT_MEDIA_ITEM to more methods.
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)
2023-01-25 18:18:42 +00:00
tonihei
b8b6ddf347 Correctly filter PlayerInfo by available getter commands.
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)
2023-01-25 18:18:42 +00:00
rohks
0606ab0cbb Fix javadoc references to writeSampleData
PiperOrigin-RevId: 502821506
(cherry picked from commit 6c14ffc1ecd13393930b9f5ee7ad7a52391d0f65)
2023-01-25 18:18:42 +00:00
tonihei
2eab93d5c5 Make availableCommands known when bundling PlayerInfo
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)
2023-01-25 18:18:42 +00:00
Googler
d41eedecb4 Disables play/pause button when there's nothing to play
PiperOrigin-RevId: 502571320
(cherry picked from commit d49a16e094d6d4bde0d1dc1ec42876c156b9c55a)
2023-01-25 18:18:42 +00:00
christosts
dd462e8cdb Filter what PlaybackStateCompat actions are advertised
PlayerWrapper advertises PlaybackStateCompat actions to the legacy
MediaSession based on the player's available commands.

PiperOrigin-RevId: 502559162
(cherry picked from commit 39f4a17ad4ac3863af22e12711247c7a87b8613e)
2023-01-25 18:18:42 +00:00
tianyifeng
79fd80f8b0 Post notification for session app when FgS starting exception is caught
PiperOrigin-RevId: 502407886
(cherry picked from commit 6ce3421ca750109acfea35029260dc3f169a1a40)
2023-01-25 18:18:42 +00:00
bachinger
818ce7271e Clarify what default settings are being used for SSAI AdsLoader
PiperOrigin-RevId: 502388865
(cherry picked from commit abe11c88ecdfe56ca31d3bffe1dd8fce6fb293af)
2023-01-25 18:18:42 +00:00
tonihei
903915de3d Fix command check in MediaControllerImplBase
The command check for setDeviceMuted was wrong.

PiperOrigin-RevId: 502355332
(cherry picked from commit cfcce9aec9d92a7067f07b2d9c00d705df0368ac)
2023-01-25 18:18:42 +00:00
tonihei
24b0367374 Add missing command checks to MediaSessionLegacyStub and PlayerWrapper
This player didn't fully check all player commands before calling the
respective methods.

PiperOrigin-RevId: 502353704
(cherry picked from commit a2a44cdc02abadd473e26e1fd9f973210d4c5f0e)
2023-01-25 18:18:42 +00:00
tonihei
55903af2f8 Remove unneccesary parameter taking Player.Command
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)
2023-01-25 18:18:41 +00:00
tonihei
13dc59fc0f Correctly map deprecated methods in MediaController to replacement
This avoids throwing exceptions for correct (but deprecated) Player
method invocations.

PiperOrigin-RevId: 502341428
(cherry picked from commit 86a95c2a4afd861986376f9dc31e0d65910e6e74)
2023-01-25 18:18:41 +00:00
tianyifeng
a2aaad65a8 Catch FgSStartNotAllowedException when playback resumes
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)
2023-01-25 18:18:41 +00:00
bachinger
b644c67924 Add AdsLoader.focusSkipButton()
This method allows to call through to `StreamManager.focus()` of the currently playing SSAI stream.

PiperOrigin-RevId: 501399144
(cherry picked from commit 16285ca5dfd4461334f5e97d4de47ae07e49e883)
2023-01-25 18:18:41 +00:00
bachinger
2c088269c6 Document that DownloadService needs notification permissions
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)
2023-01-25 18:18:41 +00:00
bachinger
1b8608f179 Request notification permission in demo app for API 33+
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)
2023-01-25 18:18:41 +00:00
bachinger
764daff417 Improve Java doc about how to override notification drawables
Issue: androidx/media#140
PiperOrigin-RevId: 501288267
(cherry picked from commit a2cf2221170e333d1d1883e0e86c5efca32f55ba)
2023-01-25 18:18:41 +00:00
bachinger
5d84804070 Use onMediaMetadataChanged for updating the legacy session
Issue: androidx/media#219
PiperOrigin-RevId: 501080612
(cherry picked from commit 375299bf364041ccef17b81020a13af7db997433)
2023-01-25 18:18:41 +00:00
bachinger
84545e0e47 Add focusSkipButtonWhenAvailable to focus UI on ATV
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)
2023-01-25 18:18:41 +00:00
tonihei
b6970c09b8 Update bandwidth meter estimates
PiperOrigin-RevId: 501010994
(cherry picked from commit 2c7e9ca8237e39bde686dd635699778aa8c6b96e)
2023-01-25 18:18:41 +00:00
rohks
96eb8968a8 Initialise fields used for bundling as String directly
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)
2023-01-25 18:18:20 +00:00
rohks
2cfd05f125 Fix typo in DefaultTrackSelector.Parameters field
PiperOrigin-RevId: 499905136
(cherry picked from commit b63e1da861d662f02d9a5888aaefb4a1b3347e40)
2023-01-25 18:17:17 +00:00
Googler
4e7ccd7ffd Throw a ParserException instead of a NullPointerException if the sample table (stbl) is missing a required sample description (stsd).
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)
2023-01-25 18:17:17 +00:00