771 Commits

Author SHA1 Message Date
tonihei
641c3b1b22 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 14:03:50 +00:00
tonihei
2d7ddccebb 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 20:29:23 +00:00
Googler
345f2345c7 Disables play/pause button when there's nothing to play
PiperOrigin-RevId: 502571320
2023-01-18 12:56:41 +00:00
ibaker
8313af1677 Fix order of playback controls in RTL layout
Issue: androidx/media#227

#minor-release

PiperOrigin-RevId: 497159283
2023-01-04 18:56:03 +00:00
ibaker
37fd65a8e5 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 17:57:57 +00:00
bachinger
33f8f40692 Use theme when loading drawables on API 21+
Issue: androidx/media#220
PiperOrigin-RevId: 495642588
2022-12-21 15:53:14 +00:00
michaelkatz
fd12fc1fb7 Rollback of 90d4fdcf0f
*** Original commit ***

Fix gradle build

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

***

PiperOrigin-RevId: 493907749
2022-12-12 14:32:14 +00:00
ibaker
221a56da38 Rollback of 749d77b1d9
*** Original commit ***

Make PlayerView fold aware

***

PiperOrigin-RevId: 493846471
2022-12-12 14:28:04 +00:00
kimvde
90d4fdcf0f Fix gradle build
Add required import for
androidx.window.java.layout.WindowInfoTrackerCallbackAdapter

PiperOrigin-RevId: 492131661
2022-12-12 11:28:57 +00:00
Googler
749d77b1d9 Make PlayerView fold aware
PiperOrigin-RevId: 491963883
2022-12-12 11:02:17 +00:00
tonihei
c1fd03df74 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-21 14:56:11 +00:00
ibaker
7d5f1a24be 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-20 03:08:12 +00:00
ibaker
a5583c04bb Remove more references to overriding layouts from Player(Control)View
In exoplayer2 this affects StyledPlayer(Control)View

#minor-release

PiperOrigin-RevId: 481878940
2022-10-20 02:46:02 +00:00
Googler
6cdaf2c031 Fix display settings window UI bug for foldable devices.
PiperOrigin-RevId: 481215581
2022-10-20 02:27:32 +00:00
ibaker
871a5e685e Fix the position of IntDef annotations on fields in the UI module
PiperOrigin-RevId: 481150758
2022-10-20 02:23:26 +00:00
ibaker
248ee469ad 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-20 02:16:24 +00:00
bachinger
f828130caf Use the current overrides of the player as preset
Issue: google/ExoPlayer#10429
PiperOrigin-RevId: 461577039
2022-07-21 12:48:36 +00:00
olly
5a16376537 Add TODOs for registerReceiver calls without flag
PiperOrigin-RevId: 461165173
2022-07-15 12:15:54 +00:00
ibaker
bf86b603a3 Ensure TalkBack announces the selected playback speed in the UI menu
Issue: google/ExoPlayer#10298
#minor-release
PiperOrigin-RevId: 457991028
2022-07-07 17:09:32 +00:00
bachinger
495480a66a 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:53:07 +00:00
bachinger
499d3f94a5 Updating translations
#minor-release

PiperOrigin-RevId: 455128997
2022-06-15 15:58:49 +00:00
bachinger
6fd777c5ca Add many quantity for fr an fr-CA
See https://issuetracker.google.com/208178382

PiperOrigin-RevId: 454949204
2022-06-15 14:57:19 +00:00
rohks
75dc0e26c5 Migrate leaf listeners of Player to new onCues override
PiperOrigin-RevId: 449587030
2022-05-24 11:55:09 +01:00
rohks
a27b5398a8 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 11:27:01 +01:00
ibaker
06d73e93e6 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-09 15:45:54 +01:00
ibaker
a840f9732f 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 11:21:14 +01:00
ibaker
6c80a82bae Rename Player.COMMAND_GET_TRACK_INFOS to COMMAND_GET_TRACKS
`Player.getCurrentTracksInfo` was renamed to `Player.getCurrentTracks` in
0ad508b14f.

PiperOrigin-RevId: 441825078
2022-04-26 15:34:35 +01:00
olly
fbd8273430 Tracks.Group/TrackGroup variable naming disambiguation
PiperOrigin-RevId: 441712166
2022-04-26 15:20:53 +01:00
olly
0ad508b14f 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:59:00 +01:00
Ian Baker
9f7abd4f42 Merge pull request #10047 from LuGO0:9432/added-filtering-for-forced-text-tracks
PiperOrigin-RevId: 439262085
2022-04-07 16:50:35 +01:00
ibaker
1d4f99cc86 Add PlayerView to the stable API
PiperOrigin-RevId: 437777445
2022-04-07 14:52:12 +01:00
ibaker
e18dfd4488 Tolerate the result of View.getLayoutParams being null
PiperOrigin-RevId: 437017422
2022-03-24 16:47:44 +00:00
olly
e2e3474bae 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
olly
dacf8f847c Rollback of ff6e641fbb
*** Original commit ***

Rollback of 20282151b5

*** Original commit ***

Fix PlayerView touch handling

Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClick...

***

PiperOrigin-RevId: 434502423
2022-03-15 00:52:19 +00:00
Saurabh kumar
c9ce23a1b9 9432 : Added support for filtering forced text tracks
1. Added filtering for forced text tracks.
2. Support for disabling all other tracks other than forced track when None is selected.
2022-03-12 01:15:16 +05:30
olly
ff6e641fbb Rollback of 20282151b5
*** Original commit ***

Fix PlayerView touch handling

Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClickListener when
   useController is false.
3. Delivery of events to a registered OnLongClickListener
   in all configurations.
4. Incorrectly treating a sequence of touch events that
   exit the bounds of the vi...

***

PiperOrigin-RevId: 433262414
2022-03-09 15:34:01 +00:00
olly
20282151b5 Fix PlayerView touch handling
Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClickListener when
   useController is false.
3. Delivery of events to a registered OnLongClickListener
   in all configurations.
4. Incorrectly treating a sequence of touch events that
   exit the bounds of the view before ACTION_UP as a click,
   both for delivery to OnClickListener and for toggling
   the controls.

Note: After this change, control visibility will not be
toggled if the application developer explicitly sets the
view to be non-clickable. I think that's probably working
as intended though. It seems correct that a non-clickable
view would not respond to clicks.

Issue: google/ExoPlayer#8627
Issue: google/ExoPlayer#9605
Issue: google/ExoPlayer#9861
PiperOrigin-RevId: 433016626
2022-03-09 15:19:43 +00:00
olly
b2a5298e27 Decouple UI module from ExoPlayer
This change rewrites the UI module's track selection
components to depend on the Player API, allowing us to
finally remove the UI module's dependency on ExoPlayer
as a concrete player implementation.

PiperOrigin-RevId: 432989318
2022-03-09 15:16:18 +00:00
ibaker
52a8caedf6 Remove unused constants from (Styled/Legacy)PlayerView
These were added in
b57aa34b66
and then not removed when the rest of the code was removed in
0b0277af50

PiperOrigin-RevId: 432419684
2022-03-04 13:07:27 +00:00
ibaker
41276e8b9b Remove media3 PlayerView javadoc references to overriding layouts
These should have been removed as part of 1391b7c65d, since we no
longer officially support overriding the layout file for this class.

This class is known as StyledPlayerView in exoplayer2.

#minor-release

PiperOrigin-RevId: 432411322
2022-03-07 11:38:51 +00:00
olly
b4e05e00f2 TrackSelectionParameters: Simplify disabling of track types
As evidenced by the somewhat awkward logic in PlayerControlView, the
previous design wasn't very friendly to expected usage. There will be
more usage when the track selection dialog components are migrated,
which would be similarly awkward without this change.

PiperOrigin-RevId: 431407675
2022-03-01 10:14:38 +00:00
Ian Baker
87d8ca0af2 Reformat some javadoc 2022-02-18 15:02:33 +00:00
olly
daf72f518c Flatten TrackSelectionParameters
PiperOrigin-RevId: 428747243
2022-02-17 14:24:02 +00:00
olly
c90745d956 Add getFormat and length to TrackGroupInfo
PiperOrigin-RevId: 428520090
2022-02-17 11:51:07 +00:00
tonihei
8792711d03 Set character limit for accessability strings to NONE
They are not normally displayed in any size-restricted UI element and don't
need a character limit.

#minor-release

PiperOrigin-RevId: 427998164
2022-02-17 11:06:41 +00:00
tonihei
6778cc7c12 Update some text descriptions to ease translations.
Some strings didn't mention the context in which they are used
(for example as item in a list, or for accessibility). This makes it
harder for translators to choose the most appropriate translation and
grammar.

Also fix repeat and shuffle mode button accessibility descriptions to
indicate the action, not the current state.

PiperOrigin-RevId: 426924163
2022-02-08 10:49:49 +00:00
ibaker
7a164ba3eb Remove LegacyPlayerView reference from comment in proguard-rules.txt
This class is deprecated (and will be removed from media3).

#minor-release

PiperOrigin-RevId: 426860018
2022-02-07 11:21:10 +00:00
ibaker
75932a0216 Mark all public 'rarely used' IntDefs as only TYPE_USE
This is a breaking change if the annotation itself is in use in Kotlin
code. It's judged that the IntDefs in this commit are unlikely to be
referred to often in Kotlin code. This is because they're either:
- Related to esoteric parts of the library, or
- In a common part of the library but only returned from methods (and
  never passed to callback methods).

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426410237
2022-02-07 11:10:11 +00:00
ibaker
9059e8835e Reshuffle the 'legacy' attrs.xml and drawables.xml files
Keep values related to LegacyPlayerView in attrs_legacy_player_view.xml
and put all values related to LegacyPlayerControlView back in their
original locations. We plan to remove LegacyPlayerView (and
attrs_legacy_player_view.xml) from media3, but will keep
LegacyPlayerControlView - so the separation of the XML files needs to
reflect this split.

#minor-release

PiperOrigin-RevId: 426406973
2022-02-07 10:51:50 +00:00
ibaker
4175b99d1b Mark LegacyPlayerView as deprecated
This type is still known as PlayerView in exoplayer2

#minor-release

PiperOrigin-RevId: 426348286
2022-02-04 14:53:23 +00:00