107 Commits

Author SHA1 Message Date
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
tianyifeng
ff3902debb Update translations
PiperOrigin-RevId: 554439196
2023-08-07 14:02:25 +00:00
rohks
4d40f2e7dd Fix dependencies for UI module
PiperOrigin-RevId: 548063325
2023-07-14 10:24:15 +01:00
michaelkatz
11dec52b6a Update build.gradle dependencies for lib-ui tests
This was missed in abd1c006fc

PiperOrigin-RevId: 545654091
2023-07-05 14:01:47 +00:00
Googler
6732c0e286 Resume/Pause on playback suppression changes with timeout.
Auto-resume playback when the removal of playback suppression due to unsuitable output is conveyed via change in playback suppression to Player.PLAYBACK_SUPPRESSION_REASON_NONE within a configurable timeout defaulting to 5 minutes.

PiperOrigin-RevId: 544411987
2023-06-29 23:17:57 +00:00
tonihei
2322462404 Do not trim audio samples by changing their timestamp
MP4 edit lists sometimes ask to start playback between two samples.
If this happens, we currently change the timestamp of the first
sample to zero to trim it (e.g. to display the first frame for a
slightly shorter period of time). However, we can't do this to audio
samples are they have an inherent duration and trimming them this
way is not possible.

#minor-release

PiperOrigin-RevId: 543420218
2023-06-29 22:50:04 +00:00
Googler
63ca2595be Add public API for isWear check in media3-common.
PiperOrigin-RevId: 541925117
2023-06-22 15:24:56 +00:00
Googler
abd1c006fc Player.Listener implementation to resolve playback suppression on Wear.
Add a Wear OS specific implementation of 'Player.Listener' to help resolving the playback suppression due to unsuitable output by launching a system media output switcher dialog.

PiperOrigin-RevId: 541698125
2023-06-20 14:02:05 +01:00
bachinger
8d8c514d12 Fix bug where PlayerView distorts video when video size is unknown
PiperOrigin-RevId: 541640959
2023-06-19 16:30:23 +01:00
ibaker
7e6dae7b31 Remove exoplayer2-only javadoc machinery from media3
This introduces whitespace-only changes in exoplayer2 due to the way
copybara stripping works.

PiperOrigin-RevId: 537296933
2023-06-05 09:47:58 +00:00
bachinger
6469fffd8f Keep aspect ratio of PlayerView when IDLE
When the video renderer is disabled, the video size is set to 0/0
and sent to listeners. The `PlayerView` potentially still has the last frame
displayed when the player is stopped or an error occurs. This may have the
effect that the frame is displayed distorted.

Not changing the aspect ratio when the video size arrives when the player is IDLE
avoids the problem. In the case when playback starts again and the renderes is
enabled, another video size is sent to the listener.

#minor-release

PiperOrigin-RevId: 534860889
2023-05-25 09:55:10 +01:00
bachinger
46fb454b3f Add artwork display mode to PlayerView
This change deprecates `PlayerView.setUseArtwork(boolean)` and
introduces `setArtworkDisplayMode(mode)` and
`artworkDisplayMode="off|fit|fill"` instead.

- off: no artwork is displayed (like deprecated useArtwork=false)
- fit: letterbox like media (like deprecated useArtwork=true)
- fill: scales the artwork to fill the entire width/weight of the player view

#minor-release

PiperOrigin-RevId: 534167226
2023-05-24 15:47:03 +01:00
ibaker
d5f9cf4f19 Add singleVariant publishing config to all published gradle files
Docs:
* https://developer.android.com/build/publish-library/configure-pub-variants#single-pub-var
* https://developer.android.com/reference/tools/gradle-api/8.0/com/android/build/api/dsl/PublishingOptions

This resolves the following warning from Android Gradle Plugin 7.2.2 and
helps unblock the upgrade to AGP 8.0.1:

> Software Components will not be created automatically for Maven
> publishing from Android Gradle Plugin 8.0. To opt-in to the future
> behavior, set the Gradle property
> `android.disableAutomaticComponentCreation=true` in the
> `gradle.properties` file or use the new publishing DSL.
>
> Affected Modules: `lib-cast`, `lib-common`, `lib-container`,
> `lib-database`, `lib-datasource`, `lib-datasource-cronet`,
> `lib-datasource-okhttp`, `lib-datasource-rtmp`, `lib-decoder`,
> `lib-effect`, `lib-exoplayer`, `lib-exoplayer-all (legacy)`,
> `lib-exoplayer-dash`, `lib-exoplayer-hls`, `lib-exoplayer-ima`,
> `lib-exoplayer-rtsp`, `lib-exoplayer-smoothstreaming`,
> `lib-exoplayer-workmanager`, `lib-extractor`, `lib-media2 (legacy)`,
> `lib-mediasession (legacy)`, `lib-muxer`, `lib-session`,
> `lib-transformer`, `lib-ui`, `lib-ui-leanback`, `test-utils`,
> `test-utils-robolectric`

Issue: androidx/media#409
PiperOrigin-RevId: 533464133
2023-05-19 17:22:21 +01:00
ibaker
b3db85133a Add android.namespace to all build.gradle files
This is a pre-requisite for the Android Studio upgrade assistant to
upgrade from AGP 7.2.2 to 8.0.1, otherwise it fails and complains
this is missing.

Issue: androidx/media#409
PiperOrigin-RevId: 533463246
2023-05-19 17:19:15 +01:00
ibaker
9366b4e50a Rollback of 509830f38f
*** Original commit ***

Rollback of 221a56da38

*** Original commit ***

Rollback of 749d77b1d9

*** Original commit ***

PiperOrigin-RevId: 531530885
2023-05-15 10:41:58 +01:00
tofunmi
bba760f6e5 Update translations
PiperOrigin-RevId: 529069808
2023-05-03 17:15:08 +01:00
tonihei
9128244dc3 Use Util method for common UI play/pause button logic.
This ensures the logic is consistent and can also be easily
used from custom UIs.

PiperOrigin-RevId: 527249127
2023-04-26 15:52:50 +01:00
tonihei
c5baf2388c Rename misleading COMMAND_GET/SET_MEDIA_ITEMS_METADATA
The setter command is only used for setPlaylistMetadata and can
be named COMMAND_SET_PLAYLIST_METADATA. The getter commnad is
used to access getMediaMetadata and getPlaylistMetadata and can
be better named COMMAND_GET_METADATA to reflect this usage.

PiperOrigin-RevId: 523673286
2023-04-12 16:59:38 +01:00
Googler
509830f38f Make PlayerView fold aware
PiperOrigin-RevId: 523413988
2023-04-12 16:51:04 +01:00
rohks
766e7d7d35 Add media3 guide entries in README files
PiperOrigin-RevId: 520650881
2023-03-30 17:28:03 +00:00
rohks
6a928805d4 Fix javadoc links in media README files
Also fixed the javadoc link in devsite and removed javadoc links from decoder extensions as it is not published yet on developer.android.com.

#minor-release

PiperOrigin-RevId: 520636868
2023-03-30 17:26:40 +00:00
tonihei
8498e4b444 Fix lint-baseline.xml for latest UI translations
#minor-release

PiperOrigin-RevId: 513533248
2023-03-02 17:21:16 +00:00
tonihei
a7faa5bfd8 Update translations
#minor-release

PiperOrigin-RevId: 512890813
2023-03-01 17:22:55 +00:00
tonihei
b3e7696ba7 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
2023-02-01 10:22:15 +00:00
tonihei
e2ece2f5bc 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
2023-01-25 18:48:15 +00:00
Googler
d49a16e094 Disables play/pause button when there's nothing to play
PiperOrigin-RevId: 502571320
2023-01-18 11:59:03 +00:00
ibaker
80603427ab Fix order of playback controls in RTL layout
Issue: androidx/media#227

#minor-release

PiperOrigin-RevId: 497159283
2023-01-04 21:38:29 +00:00
ibaker
4087a011e2 Fix recursive loop when registering controller visibility listeners
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
2022-12-21 15:36:58 +00:00
bachinger
22dfd4cb32 Use theme when loading drawables on API 21+
Issue: androidx/media#220
PiperOrigin-RevId: 495642588
2022-12-21 15:01:09 +00:00
michaelkatz
d64a7ec55c Rollback of c5dc5aeb11
*** Original commit ***

Fix gradle build

Add required import for
androidx.window.java.layout.WindowInfoTrackerCallbackAdapter

***

PiperOrigin-RevId: 493907749
2022-12-12 11:40:08 +00:00
ibaker
481f3fa7c7 Rollback of 46b4ebc7b6
*** Original commit ***

Make PlayerView fold aware

***

PiperOrigin-RevId: 493846471
2022-12-12 11:39:02 +00:00
ibaker
636a4a8538 Add javadoc links to README files
Fix some other link titles and destinations spotted along the way.

#minor-release

PiperOrigin-RevId: 493276172
2022-12-12 11:19:23 +00:00
kimvde
c5dc5aeb11 Fix gradle build
Add required import for
androidx.window.java.layout.WindowInfoTrackerCallbackAdapter

PiperOrigin-RevId: 492131661
2022-12-12 10:51:03 +00:00
Googler
46b4ebc7b6 Make PlayerView fold aware
PiperOrigin-RevId: 491963883
2022-12-12 10:44:02 +00:00
tonihei
22ccc1a128 Mark broadcast receivers as not exported
They are called from the system only and don't need to be exported
to be visible to other apps.

PiperOrigin-RevId: 489210264
2022-11-22 09:54:45 +00:00
ibaker
a5b09b8ccc Remove ForwardingPlayer special case from PlayerControlView.setPlayer
This was originally added in 4fd7d777b6, but it hasn't done anything
since 98ee159df1 (when the instanceof ExoPlayer check was removed).

PiperOrigin-RevId: 482161662
2022-10-24 10:37:05 +00:00
ibaker
cc1d35cfd7 Remove more references to overriding layouts from Player(Control)View
In exoplayer2 this affects StyledPlayer(Control)View

#minor-release

PiperOrigin-RevId: 481878940
2022-10-24 10:30:39 +00:00
Googler
0128fa36e7 Fix display settings window UI bug for foldable devices.
PiperOrigin-RevId: 481215581
2022-10-17 16:03:12 +00:00
ibaker
e1d3f1b863 Fix the position of IntDef annotations on fields in the UI module
PiperOrigin-RevId: 481150758
2022-10-17 16:02:16 +00:00
ibaker
e97b25a668 Mark effectively-final PlayerControlView fields as actually final
This means the null checker can be more sure that these fields don't
get reassigned between a null-check and a usage.

PiperOrigin-RevId: 481142004
2022-10-17 16:00:27 +00:00
bachinger
5c2aabca66 Use the current overrides of the player as preset
Issue: google/ExoPlayer#10429
PiperOrigin-RevId: 461577039
2022-07-21 12:39:46 +00:00
olly
9271572e95 Add TODOs for registerReceiver calls without flag
PiperOrigin-RevId: 461165173
2022-07-15 12:19:04 +00:00