749 Commits

Author SHA1 Message Date
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
ibaker
1391b7c65d Remove references to Player(Control)View from the dev guide
Remove most of the customisation documentation, since StyledPlayerView
isn't really designed to be customised as deeply as PlayerView.

Also remove most documentation around StyledPlayerControlView,
especially as a standalone controller class - since it doesn't work
well for this use-case.

#minor-release

PiperOrigin-RevId: 426090762
2022-02-04 10:09:40 +00:00
olly
5d7641c6f1 Fix some lint warnings
PiperOrigin-RevId: 424383900
2022-01-28 09:37:06 +00:00
olly
abef4f4e14 Use translatable playback speed strings
Issue: google/ExoPlayer#9811
PiperOrigin-RevId: 423855051
2022-01-25 20:01:06 +00:00
olly
34102ee1e2 Update translations
Issue: google/ExoPlayer#9811
PiperOrigin-RevId: 423849421
2022-01-25 19:57:15 +00:00
ibaker
915f091ebd Remove 'styled' from styledPlayerControlView field name
This class is already called StyledPlayerControlViewLayoutManager, it
seems unecessary to repeate the 'styled' word again in this context.

PiperOrigin-RevId: 420711161
2022-01-10 12:57:27 +00:00
ibaker
103b170a56 Rename some references from PlayerView to LegacyPlayerView
These were missed in 46ab94bd41

These references will be re-written to PlayerView when exporting to
exoplayer2, so this commit results in some small reformatting changes.

Also fix a reference to LegacyPlayerControlView that should be
StyledPlayerControlView.

PiperOrigin-RevId: 420707706
2022-01-10 12:53:59 +00:00
olly
ac6207c99a Add translatable playback speed strings
The UI component will be switched over to use them in a
subsequent commit, once the translations have been
imported.

Issue: google/ExoPlayer#9811
PiperOrigin-RevId: 419632617
2022-01-05 12:46:14 +00:00
ibaker
46ab94bd41 Rename PlayerView to LegacyPlayerView in media3
The old name is kept in exoplayer2.

PiperOrigin-RevId: 417378759
2021-12-20 13:53:35 +00:00
ibaker
3aae0cbff3 Fix some comment references in StyledPlayer(Control)View
These comments inadvertantly refer to types and drawables associated
with Player(Control)View.

PiperOrigin-RevId: 416794967
2021-12-20 12:44:02 +00:00
ibaker
586dd355d1 Move Player(Control)View resource IDs into separate _legacy.xml files
This is a no-op because all the <resource> elements from these XML
files are effectively concatenated together during building.

PiperOrigin-RevId: 416326534
2021-12-15 12:19:19 +00:00
olly
dff04b343e Fix FFWD/RWND color in night mode
The color set via textAppearance is overridden by any non-null
textColor set directly on the style. We always want the specific
properties the textAppearance specifies, so set them directly to
prevent them from being overridden.

#minor-release
Issue: google/ExoPlayer#9765
PiperOrigin-RevId: 414967143
2021-12-10 16:27:39 +00:00
bachinger
8618e4b05c Document that channelNameResourceId needs to be set
This is documented on the setter already, but it seems to make sense to do this in the constructor as well for clarity.

Issue: google/ExoPlayer#9550
PiperOrigin-RevId: 411675700
2021-11-26 15:26:35 +00:00
tonihei
70e2e8e4d0 Assign class member in StyledPlayerControlView before using it
The local tracks variable was used to assign the initial subtext
for the current track selection in the menu, but the new value
was only assigned after the subtext has been evaluated.

Assign the local variable first, so that the remaining accesses
the latest value.

Issue: google/ExoPlayer#9698
PiperOrigin-RevId: 410750396
2021-11-18 13:51:46 +00:00
tonihei
6c1d5e7e81 Remove disabled types in StyledPlayerControlView when selecting tracks.
When selecting an explicit track or "Auto", we need to remove any
existing track type disabling. Otherwise the track override won't work.

Issue: google/ExoPlayer#9692
PiperOrigin-RevId: 410250313
2021-11-16 16:22:09 +00:00
tonihei
1d81d7e501 Use buildUpon instead of creating new overrides in UI ControlView.
Creating a new set of overrides removes previously set overrides that
should be kept.

Issue: google/ExoPlayer#9690
PiperOrigin-RevId: 409933541
2021-11-15 11:36:34 +00:00
olly
67e1499956 Fixes for some minor misc issues
- Unnecessary deprecation suppressions
- Dead code
- Broken Javadoc

PiperOrigin-RevId: 409357884
2021-11-15 10:58:32 +00:00
tonihei
cb60425aab Fully support per-track-type selection overrides.
Currently, TrackSelectionOverrides are documented as being applied
per track type, meaning that one override for a type disables all
other selections for the same track type. However, the actual
implementation only applies it per track group, relying on the
track selector to never select another renderer of the same type.

This change fixes DefaultTrackSelector to fully adhere to the
TrackSelectionsOverride definition. This solves problems when
overriding tracks for extension renderers (see Issue: google/ExoPlayer#9675)
and also simplifies a workaround added to StyledPlayerView.

#minor-release

PiperOrigin-RevId: 409121711
2021-11-11 13:27:26 +00:00
ibaker
7de079493c Migrate usages of Window-based Player methods
Where this introduced an inconsistency (e.g. assigning to something
called `windowIndex`), I generally renamed the transitive closure of
identifiers to maintain consistency (meaning this change is quite
large). The exception is code that interacts with Timeline and Window
directly, where sometimes I kept the 'window' nomenclature.

#minor-release

PiperOrigin-RevId: 407040052
2021-11-02 12:08:18 +00:00
ibaker
1c824561c6 Migrate callers of deprecated C.java methods to Util.java
#minor-release

PiperOrigin-RevId: 406166670
2021-10-29 11:31:50 +01:00
andrewlewis
0ad1cdbfa1 Tidy READMEs
PiperOrigin-RevId: 405598530
2021-10-26 14:08:21 +01:00
krocard
1f3f22a709 Encapsulate TrackSelectionOverrides in its own class
The current API exposes an `ImmutableMap` of
`TrackGroup` -> `TrackSelectionOverride`.
This has several disadvantages:
 - A difficult to use API for mutation
   (`ImmutableMap.Builder` doesn't support key removal).
 - There is no track selection specific methods,
   how the generic map API mapps to the selection override is not complex
   but to obvious for a casual reader.
 - The internal data type is exposed, making internal refactor difficult.

This was done to have the API ready as quick as possible.

When transitioning the clients to the map API in <unknown commit>,
it became clear that the map API was too verbose and not mapping
to the clients needs, so utility methods
were added to make operations clearer and more concise.

Nevertheless, having to use utility method to use easily and correctly
an API is not the sign of a good API.

This cl refactors the track selection API for several improvements:

 - Add a type `TrackSelectionParameters` that encapsulate the internal
   data structure (map currently).
 - For iteration, expose as a list.
 - Add a `Builder` for easy mutable operations.
 - Add track selection specific methods to avoid having utilities functions.
 - Those operations are the same as `DefaultTrackSelector.Parameters`
   for easier migration. (`setOverride` was renamed to `addOverride`)
 - Move `TrackSelection` classes outside of `TrackSelectionParameters`
   as their own top level classes.

The migration of the client code is straightforward as most of it
were already using the previously mentioned utility functions
that are now native methods.

The full migration has not been done yet, and is pending on this cl approval.

PiperOrigin-RevId: 405362719
2021-10-25 13:52:58 +01:00
bachinger
0555ae0a92 Move translated strings for download notification to lib-exoplayer
PiperOrigin-RevId: 404316538
2021-10-20 13:39:38 +01:00