89 Commits

Author SHA1 Message Date
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
ibaker
3fc6a66527 Ensure TalkBack announces the selected playback speed in the UI menu
Issue: google/ExoPlayer#10298
#minor-release
PiperOrigin-RevId: 457991028
2022-07-04 19:43:48 +00:00
bachinger
61ab75b8b8 Add lint base xml file for string.xml files
Fixing lint errors in the string.xml files makes no sense because these are
overridden with the next automated string import. Adding a lint-baseline.xml
instead for the ui module.

See https://issuetracker.google.com/208178382

#minor-release

PiperOrigin-RevId: 455354304
2022-06-16 12:58:29 +00:00
bachinger
958105c91c Updating translations
#minor-release

PiperOrigin-RevId: 455128997
2022-06-15 15:34:08 +00:00
bachinger
1f380c1dd3 Add many quantity for fr an fr-CA
See https://issuetracker.google.com/208178382

PiperOrigin-RevId: 454949204
2022-06-15 15:26:36 +00:00
rohks
001090cc43 Migrate leaf listeners of Player to new onCues override
PiperOrigin-RevId: 449587030
2022-05-24 11:02:03 +01:00
rohks
c728647290 Create new class to store cues and timestamp.
We need to pass timestamp for the list of cues so we are defining a new class CueGroup which will store both cues and timestamp.

PiperOrigin-RevId: 449212054
2022-05-24 10:49:48 +01:00
ibaker
54d8b5bc7c Don't implement Player.Listener from SubtitleView
We never register SubtitleView as a Player.Listener directly, it's
always done via PlayerView.

PiperOrigin-RevId: 447467037
2022-05-10 17:48:12 +01:00
ibaker
8323c69ed2 Allow stable API users to register PlayerView listeners
These listeners cover controller visibility and fullscreen button
clicks.

PiperOrigin-RevId: 445420757
2022-05-09 10:41:49 +01:00
ibaker
abbd7652b1 Add more UI symbols (and some others) to the stable API
These are used by the main demo app and would be reasonably used by
other relatively simple media playback apps.

PiperOrigin-RevId: 445371266
2022-05-09 10:37:42 +01:00
ibaker
5766cd52ba Add copies of PlayerControlView's public listeners to PlayerView
Developers are expected to (eventually) only use methods on
PlayerView (and not PlayerControlView) to interact with the UI
controller.

PiperOrigin-RevId: 445361488
2022-05-09 10:35:58 +01:00
ibaker
5186798db9 Rename Player.COMMAND_GET_TRACK_INFOS to COMMAND_GET_TRACKS
`Player.getCurrentTracksInfo` was renamed to `Player.getCurrentTracks` in
83daa052cb.

PiperOrigin-RevId: 441825078
2022-04-26 14:41:41 +01:00
olly
d9f0c2c071 Tracks.Group/TrackGroup variable naming disambiguation
PiperOrigin-RevId: 441712166
2022-04-26 14:37:35 +01:00
olly
83daa052cb Rename TracksInfo and TrackGroupInfo
1. TracksInfo is renamed to Tracks
2. TracksInfo.TrackGroupInfo is renamed to Tracks.Group

PiperOrigin-RevId: 441232373
2022-04-26 14:30:14 +01:00
Ian Baker
ea61511a24 Merge pull request #10047 from LuGO0:9432/added-filtering-for-forced-text-tracks
PiperOrigin-RevId: 439262085
2022-04-06 11:50:35 +01:00
ibaker
2a2873840d Add PlayerView to the stable API
PiperOrigin-RevId: 437777445
2022-04-06 11:11:54 +01:00
ibaker
da3cb63c5e Remove exo_legacy_player_view.xml from media3
This is only used by LegacyPlayerView which was removed in
6aa1816bd3

PiperOrigin-RevId: 437018966
2022-03-24 16:54:31 +00:00
ibaker
90d1c6fc33 Tolerate the result of View.getLayoutParams being null
PiperOrigin-RevId: 437017422
2022-03-24 16:47:44 +00:00
olly
ea2fbfd0a1 Suppress new nullness warnings when stub for View.getLayoutParams is added.
I am suppressing these warnings so that the stub file can be added and future usages will be checked correctly. As noted in https://developer.android.com/reference/android/view/View#getLayoutParams() this can be null before params are set. This was produced by running the TGP on <unknown commit>.

More information: go/new-nullness-stubs-lsc

Tested:
    Automated deflaking failed to skip failures:  http://mondo/deflaker/run/ff55923b-d76d-4eba-86dc-1b3077362352
    http://test/OCL:435678706:BASE:436509228:1647985874385:4fae6f0a
    Some test failures are present, but the CL author has decided to mail the change anyway
PiperOrigin-RevId: 436951684
2022-03-24 10:15:13 +00:00