148 Commits

Author SHA1 Message Date
tonihei
af6ad43ca0 Disable the language/role flag preferences when selecting "none"
Just clearing the overrides only helps if a text override was
previously set. If the text is shown because of app defined track
selection parameters for language or role flags, the "none" button is
currently not working and we need to clear these flags explicitly.

PiperOrigin-RevId: 682373821
2024-10-04 10:42:27 -07:00
ibaker
3e8ecbf564 Remove @DoNotInline annotations
This is no longer needed now our `compileSdk` implies a new-enough AGP
which does this out-lining automatically via R8. See also
https://issuetracker.google.com/345472586#comment7

There's no plan to remove the `ApiXXX` classes, but no new ones need
to be added.

PiperOrigin-RevId: 675940634
2024-09-18 04:47:39 -07:00
Googler
087e75850e Add suitable output checker tests relevant for API 35+ in media3-ui
PiperOrigin-RevId: 675678257
2024-09-17 13:05:43 -07:00
oceanjules
25bb8e411b Make setFullscreenButtonState UnstableApi 2024-09-16 20:19:55 +01:00
oceanjules
5536b73a08 Format with google-java-format 2024-09-16 20:05:02 +01:00
theskyblockman
370a4c0035 Deleted redundant check 2024-09-16 20:05:02 +01:00
theskyblockman
c42f53fcc9 Edited condition to exit updateIsFullscreen quickly 2024-09-16 20:05:02 +01:00
theskyblockman
4a4b3a3bc0 - Rephrased/Expanded javadocs for fullscreen methods
- Replaced all occurrences of "FullScreen" to "Fullscreen"
2024-09-16 20:05:02 +01:00
theskyblockman
49af9228db Added public-facing calls to set whether to show [fullScreenButton] or [minimalFullScreenButton] in PlayerView calling PlayerControlView 2024-09-16 20:05:02 +01:00
ibaker
87bd9ba585 Make PlayerView Compose workaround opt-in
The workaround causes issues with XML-based shared transitions, so we
can't apply it unilaterally.

Issue: androidx/media#1594

Issue: androidx/media#1237
PiperOrigin-RevId: 670960693
2024-09-04 07:24:27 -07:00
jbibik
c851464063 Add a note on not using PlayerControlView as a standalone component
We have a tracking bug Issue: androidx/media#514 for supporting it, but issues like Issue: androidx/media#1542 still show that users stumble over it.

PiperOrigin-RevId: 670955189
2024-09-04 07:02:17 -07:00
tianyifeng
1ffc962fde Update translations
#cherrypick

PiperOrigin-RevId: 663705597
2024-08-16 06:06:40 -07:00
Googler
a76ff16179 Manage wakelock when playback suppression is being handled.
After this change, a WakeLock of PowerManager#PARTIAL_WAKE_LOCK level would be acquired when the media is paused due to playback attempt without suitable output.
This WakeLock will be release either when the suitable media output has been connected or the set timeout to do so has expired.

PiperOrigin-RevId: 661570346
2024-08-10 02:28:12 -07:00
kak
2202397758 Automated Code Change
PiperOrigin-RevId: 660491742
2024-08-07 12:28:25 -07:00
Gaëtan Muller
7406b78fbc Update javadoc 2024-07-24 16:17:01 +01:00
tonihei
d4c6e39dfb Further unapplied rotation clean-up
Now the value is guaranteed to be zero (see bb9ff30c3a), we can
remove the rotation handling for it in the UI module. We can also
enforce the documentation more clearly by not even setting the
value to anything other than zero.

PiperOrigin-RevId: 652772091
2024-07-16 03:35:46 -07:00
ibaker
6a9ff95bf0 Bump minSdk to 21 and remove resulting simple dead code
All other AndroidX libraries have already increased their min SDK to
21.

This change renames private symbols to remove `V21` suffixes and
similar, but doesn't change public or protected symbols with similar
names, to avoid needless breakages/churn on users of the library.

Some of the dead code removal is more complex, so I've split it out
into follow-up changes to make it easier to review.

PiperOrigin-RevId: 651776556
2024-07-12 08:11:01 -07:00
tianyifeng
6bf2461f80 Update translations
#cherrypick

PiperOrigin-RevId: 648385733
2024-07-01 09:02:21 -07:00
Sergei Dryganets
457deec4eb Stop using what == 0 for messages. 2024-06-24 16:26:27 +01:00
ibaker
99803066ea Add null-check to PlayerView to avoid NPE in edit mode
Previously we assumed that `surfaceSyncGroupV34` was always non-null on
API 34, but this isn't true in edit mode. Instead we add an explicit
null-check before accessing it. We don't need to null-check it at the
other usage site because we are already null-checking `surfaceView` (via
`instanceof` check).

Issue: androidx/media#1237

#cherrypick

PiperOrigin-RevId: 645008049
2024-06-20 06:30:42 -07:00
ibaker
968f72fec6 Use SurfaceSyncGroup to ensure resize transaction isn't dropped
This workaround is only applied on API 34, because the problem isn't
present on API 33 and it is fixed in the platform for API 35 onwards.

Issue: androidx/media#1237

#cherrypick

PiperOrigin-RevId: 644729909
2024-06-19 06:27:13 -07:00
kimvde
d27549d29a Skip 4K export test on Pixel 3a
PiperOrigin-RevId: 644659699
2024-06-19 01:18:05 -07:00
tonihei
4cd8d64446 Image support in PlayerView
Images are rendered into an ImageView (on top of the video shutter).
The image view is set to the images emitted by ExoPlayer's ImageOutput
and cleared when there is no longer a selected image track.

In order to keep the existing behavior of video tracks to only clear
the old output once the new first frame is rendered (avoiding short
periods of black between playlist items), we have to reorder this code
slightly to make it work for video and images. Both are treated in the
same way. If both are enabled, video takes precedence.

As the UI module only depends on the common module, we can't direcly
add the ImageOutput to ExoPlayer. This is done via reflection if
the provided Player is an ExoPlayer.

#cherrypick

PiperOrigin-RevId: 643320666
2024-06-14 05:33:23 -07:00
tonihei
ebe74daaec Add image samples and track selection to demo app
Also move the track selection header strings to the demo app
as they are only used there (except for audio, which stays in UI)

PiperOrigin-RevId: 642616037
2024-06-12 08:02:52 -07:00
jbibik
f3444aee5f Add icons for fastforward and rewind buttons
PiperOrigin-RevId: 640206040
2024-06-04 10:46:36 -07:00
jbibik
d35bc176ff Allow customisation of various icons in PlayerControlView
Before this change:
The only way to customize the icons was to override the drawables, e.g.
* `exo_styled_controls_play`
* `exo_styled_controls_pause`

However, that would set the drawables globally and prevent users from customizing the icons **per** PlayerView.

After the change, it is possible to provide drawable icons in the xml layout directly via `<androidx.media3.ui.PlayerView>` and
* `app:play_icon="@drawable/...`
* `app:pause_icon="@drawable/...`
* `app:vr_icon="@drawable/...`
* `app:fullscreen_exit_icon="@drawable/...`
* `app:next_icon="@drawable/...`

Note:
Two buttons that are left out of this change are fast-forward and rewind. They are more complicated due to layout insertion and customization with seek back/forward increments in the TextView.

Issue: androidx/media#1200
PiperOrigin-RevId: 639832741
2024-06-03 10:32:39 -07:00
ibaker
5d6f514897 Remove references to LegacyPlayerView
This is an internal name for the exoplayer2 `PlayerView` that was never
published as part of media3.

PiperOrigin-RevId: 623120907
2024-04-09 04:12:42 -07:00
tonihei
516d4ce1fd Reduce androidx.media usage in UI module to API < 21.
The androidx.media library is only used for its compat MediaStyle.
On API 21 and above, the logic can be easily inlined, and only
on API < 21, the androidx.media handling can be used.

This allows to remove the androidx.media dependency completely
once the minSdk has been increased to 21.

PiperOrigin-RevId: 622855469
2024-04-08 08:50:23 -07:00
sheenachhabra
d57229ad15 Import string translations
#minor-release

PiperOrigin-RevId: 621828038
2024-04-04 05:38:42 -07:00
ibaker
d684cdb330 Add PlayerView.setControllerAnimationEnabled(boolean)
Issue: androidx/media#1227
PiperOrigin-RevId: 619558900
2024-03-27 09:40:09 -07:00
ibaker
ebfd540817 Fix javadoc on PlayerView.setControllerVisibilityListener
#minor-release

PiperOrigin-RevId: 619536799
2024-03-27 08:20:38 -07:00
Ian Baker
e24febf1e2 Small clean-ups and added @InlineMe annotation 2024-02-13 14:48:15 +00:00
Ian Baker
205c8734cc In-line more V19 methods in TrackSelectionParameters, AudioTimestampPoller and CaptionStyleCompat 2024-02-13 10:26:20 +00:00
Gaëtan Muller
963e517a5a Remove unnecessary RequiresApi annotation 2024-02-13 10:26:19 +00:00
Gaëtan Muller
973b717914 Remove unnecessary SDK_INT checks 2024-02-13 10:26:19 +00:00
michaelkatz
0b0c419c73 Fallback to including track language name if display name is not found
Issue: androidx/media#988
PiperOrigin-RevId: 606193299
2024-02-12 03:07:36 -08:00
tonihei
ed5b7004b4 Replace or suppress deprecated usages
Many usages are needed to support other deprecations and some
can be replaced by the recommended direct alternative.

Also replace links to deprecated/redirected dev site

PiperOrigin-RevId: 601795998
2024-01-26 10:06:18 -08:00
sheenachhabra
b98e5ac0d4 Suppress lint warning about missing POST_NOTIFICATIONS permission
For media session related notifications, permission is not required.
https://developer.android.com/develop/ui/views/notifications/notification-permission#exemptions-media-sessions

#minor-release

PiperOrigin-RevId: 600819251
2024-01-23 09:46:50 -08:00
Christine Coenen
793b27af3b Fix forward and rewind button texts cut off with material theme applied 2023-12-21 16:28:38 +01:00
tonihei
310e2edcca Workaround layout problems with Material Design
In some contexts (e.g. BottomSheetDialogFrament), Material Design
themes will override the default of singleLine=false to true. This
causes layout problems because the forward/rewind buttons are no
longer visible with singleLine=true.

This problem can be avoided by explicitly requesting the default
value of false in our layout files.

Issue: androidx/media#511

#minor-release

PiperOrigin-RevId: 582604131
2023-11-15 02:57:03 -08:00
andrewlewis
a7d47d4526 Add info about using SurfaceView instead of TextureView
PiperOrigin-RevId: 580145645
2023-11-07 05:35:09 -08:00
rohks
a8ab9e2c70 Update translations in the ui module
#minor-release

PiperOrigin-RevId: 575161190
2023-10-20 02:52:30 -07:00
Googler
dc859eae82 Fix the resumption of playback when suitable device is connected.
With this change the playback will resume as soon as the suitable device is connected and suppression reason is cleared (within set time out).

#minor-release

PiperOrigin-RevId: 572140309
2023-10-09 22:52:16 -07:00
ibaker
d716de02aa Suppress lint in PlayerControlView and TrackSelectionDialogBuilder
PiperOrigin-RevId: 569165562
2023-09-28 06:48:54 -07:00
tonihei
69ffac28bb Set SurfaceView lifecycle to follow attachment in PlayerView
This avoids destroying the surface if PlayerView is hidden in the
view hierarchy.

PiperOrigin-RevId: 568501459
2023-09-26 04:58:11 -07:00
ibaker
d965516dc9 Fix 'unused return value' error in SubtitleViewUtilsTest
PiperOrigin-RevId: 568170342
2023-09-25 03:50:30 -07:00
tonihei
f89053dbb0 Change UI module documentation link
PiperOrigin-RevId: 566257915
2023-09-18 04:09:46 -07:00
tonihei
f285334a15 Deprecate multi-window time bar mode
It's much better to merge the windows at source level to reflect the
same state everywhere (e.g. notifications, player state, etc). This
can be done with ConcatenatingMediaSource2.

PiperOrigin-RevId: 563715718
2023-09-08 04:46:43 -07:00
tonihei
597de8706d Show play button during playback suppression by default
This changes the default logic of shouldShowPlayButton to show a play
button while the playback is temporarily suppressed. This helps to
provide better UI feedback to the fact that playback stopped and
provides a quick way for users to override the suppression and attempt
to restart playback.

Some apps may want to keep the legacy behavior depending on their app's
needs. Hence, we also add a config parameter to set this behavior both
in MediaSession and our default UI components.

Issue: google/ExoPlayer#11213
PiperOrigin-RevId: 557129171
2023-08-15 17:15:38 +01:00
kimvde
117b18f54c Check command availability before getting tracks in PlayerView
#minor-release

PiperOrigin-RevId: 554451569
2023-08-07 14:03:27 +00:00