702 Commits

Author SHA1 Message Date
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
olly
d601875452 Rename releaseArtifact to releaseArtifactId
PiperOrigin-RevId: 404059404
2021-10-18 22:45:47 +01:00
kimvde
5ef00f0e96 Remove deprecated ControlDispatcher
The possibilities to set a ControlDispatcher have been removed in
<unknown commit> so that the ControlDispatcher is always a
DefaultControlDispatcher.

PiperOrigin-RevId: 403327092
2021-10-15 12:45:39 +01:00
kimvde
746ad2e6aa Remove deprecated ControlDispatcher from API surface
PiperOrigin-RevId: 403101980
2021-10-14 17:03:23 +01:00
krocard
3b8eba2dea Refactor initTrackSelectionAdapter
As suggested in parent change, return a list of
`TrackType` instead of appending to it.

This has the slight disadvantage of iterating twice
over the (short) list, but clarifies the code.

PiperOrigin-RevId: 402844458
2021-10-14 11:58:53 +01:00
krocard
98ee159df1 Use TracksInfo and selection override in users
Update the UI module, the demos and most other users
to make use of the new player TracksInfo and track
selection override APIs.

PiperOrigin-RevId: 402817857
2021-10-14 11:54:45 +01:00
olly
e160649d9c README updates for MediaSource, DataSource and UI modules
PiperOrigin-RevId: 401793145
2021-10-09 18:21:54 +01:00
olly
e7c6ed5e7f Mechanical README cleanups
PiperOrigin-RevId: 401767060
2021-10-09 18:14:36 +01:00
andrewlewis
1d29f12677 Update translations
PiperOrigin-RevId: 401767033
2021-10-09 18:10:12 +01:00
olly
d45cf6028d Remove reference to ExoPlayer from UI module
PiperOrigin-RevId: 401751490
2021-10-09 17:54:50 +01:00
ibaker
fc25798af6 Add public.xml to UI module with an empty <public /> node
This is the recommended way to mark all resources as private:
https://developer.android.com/studio/projects/android-library#PrivateResources

PiperOrigin-RevId: 401470108
2021-10-07 21:57:50 +01:00
ibaker
ee71c8387c Migrate usages of deprecated Player COMMAND_ constants
PiperOrigin-RevId: 401292817
2021-10-06 21:19:37 +01:00
olly
80d365163d Rollback of 912c47ff6f
*** Original commit ***

Rollback of 8ed6c9fcf5

*** Original commit ***

Fix capitalization of language in track selector

Issue: #9452

***

***

PiperOrigin-RevId: 400942287
2021-10-05 23:18:25 +01:00
krocard
ac881be2fc Add TracksInfo to the Player API
TracksInfo is very similar to
`MappingTrackSelector.MappedTracksInfo` with some
fields removed to simplify the Player API,
notably it doesn't expose the renderer concept.

A significant difference is the addition of a `selected` boolean
field which avoids having a separate `getCurrentTrackSelection`
API.

This cl is a part of the bigger track selection change,
splitted for ease of review.

In particular, the MediaSession implementation and UI usage
have been slitted in child cls.

Find all cls with the tag:
#player-track-selection

PiperOrigin-RevId: 400937124
2021-10-05 23:15:16 +01:00
olly
912c47ff6f Rollback of 8ed6c9fcf5
*** Original commit ***

Fix capitalization of language in track selector

Issue: #9452

***

PiperOrigin-RevId: 400706984
2021-10-04 15:40:47 +01:00
olly
ac4a7e919a Remove ExoPlayer link from UI module
PiperOrigin-RevId: 400706800
2021-10-04 15:37:48 +01:00
olly
8ed6c9fcf5 Fix capitalization of language in track selector
Issue: #9452
PiperOrigin-RevId: 400680794
2021-10-04 12:13:49 +01:00
bachinger
168d0cc9a6 Merge pull request #9525 from talklittle:fix-initial-position
PiperOrigin-RevId: 400666736
2021-10-04 11:56:36 +01:00
bachinger
014ee8f5d8 Remove fully qualified class names in link tags
PiperOrigin-RevId: 400224459
2021-10-04 11:53:39 +01:00
Andrew Shu
e883c04006 Fix setting initial 0 position in PlayerControlView 2021-10-03 15:58:05 -07:00
ibaker
ad99a44083 Add empty sdk-version node to all AndroidManifest.xml files
PiperOrigin-RevId: 397772916
2021-09-21 14:17:33 +01:00
andrewlewis
71a4b6337c Fix javadoc consistency
#exofixit

PiperOrigin-RevId: 396304941
2021-09-14 11:56:45 +01:00
klhyun
442a5f4500 Update PlayerView's UI when available commands change
PiperOrigin-RevId: 395395015
2021-09-08 16:58:44 +01:00
olly
86f8c4e44e Fix some PlayerControlView accessibility issues
- Fix focus when pausing and resuming
- Prevent repeated readout of the playback position when paused

#exofixit
#minor-release
Issue #9111

PiperOrigin-RevId: 395301765
2021-09-07 20:28:54 +01:00
olly
730cdbb9e6 Use defStyleAttr when obtaining styled attributes in player views
#minor-release
#exofixit
Issue #9024

PiperOrigin-RevId: 395224661
2021-09-07 17:48:45 +01:00
andrewlewis
654a320792 Remove stray symlinks
These are unneeded for the external project

#minor-release

PiperOrigin-RevId: 392835942
2021-08-25 10:58:20 +01:00
bachinger
2f09ecef53 Make constructor of PlayerNotificationManager protected
Issue: #9303
#minor-release
PiperOrigin-RevId: 392022613
2021-08-23 14:08:39 +01:00
olly
3f16730763 Support generating notifications for paused downloads
- Android 12 will not allow our download service to be
  restarted from the background when conditions that
  allow downloads to continue are met. As an interim
  (and possibly permanent) solution, we'll keep the
  service in the foreground if there are unfinished
  downloads that would continue if conditions were met.
- Keeping the service in the foreground requires a
  foreground notification. Hence we need to be able to
  generate a meaningful notification for this state.

PiperOrigin-RevId: 391969986
2021-08-20 16:25:43 +01:00
kimvde
1ae879788a Fix issue caused by using ForwardingPlayer and StyledPlayerControlView
StyledPlayerControlView was checking whether the player is an ExoPlayer
instance to set the track selector. This means that, if apps were
wrapping an ExoPlayer in a ForwardingPlayer (to replace a
ControlDispatcher for example), the track selector wasn't set anymore.

#minor-release

PiperOrigin-RevId: 391776305
2021-08-20 11:49:12 +01:00
andrewlewis
ce4c8e405c Add some range annotations
PiperOrigin-RevId: 391253301
2021-08-17 15:48:10 +01:00
olly
38e5864f87 Remove Player.Listener inheritance of TextOutput
PiperOrigin-RevId: 390630998
2021-08-17 15:37:29 +01:00
kimvde
01613a2e55 Remove usages of deprecated SimpleExoPlayer.Builder
PiperOrigin-RevId: 390130681
2021-08-11 17:34:19 +01:00
olly
7dffb2dc4d Migrate to Player.Listener
PiperOrigin-RevId: 390124675
2021-08-11 17:32:55 +01:00
ibaker
db1fe8041b Remove @DoNotInstrument from test classes
This isn't needed now we've updated to Robolectric 4.6

Follow-up to 0df0df9aee

PiperOrigin-RevId: 389616471
2021-08-09 20:02:05 +01:00
andrewlewis
9c27cfcda7 Fix parameter names on overridden methods
The dokka javadoc generation tool complains when parameter names don't match between a method and its override. This change updates occurrences where there is currently a mismatch.

Notable renamings that might be controversial:
- `onPlaybackStateChanged(int state)` to `onPlaybackStateChanged(int playbackState)` affected a lot of lines but seems more consistent with other '-Changed' methods.
- `handleMessage(int messageType, Object payload)` to `handleMessage(int messageType, Object message)`
- `ExtractorInput` and `DataSource` inherit `DataReader` which had `read(byte[] target, ...`, while data sources normally called the first parameter `buffer`. I have standardized these all to use `buffer` even though it looks out of place in the `ExtractorInput` interface (which has more `read` methods with `target`).

PiperOrigin-RevId: 387290360
2021-07-28 09:15:29 +01:00
samrobinson
0b0277af50 Set StyledPlayerView/PlayerView artwork from MediaMetadata.
PiperOrigin-RevId: 385763366
2021-07-21 14:41:20 +01:00
kimvde
31c9875ec9 Deprecate ControlDispatcher in the UI
PiperOrigin-RevId: 385129211
2021-07-20 08:38:13 +01:00
kimvde
3830848888 Use Player methods in DefaultControlDispatcher
PiperOrigin-RevId: 385118021
2021-07-20 08:36:46 +01:00
klhyun
f173ffa972 Do not set aspect ratio if unknown.
When the size of the video is unknown,
PlayerView and StyledPlayerView set the aspect ratio as 1,
which could result in wrong view layout.

This CL sets the aspect ratio as 0 (unset) to prevent that.

This handles Issue: #9189.

PiperOrigin-RevId: 385115357
2021-07-20 08:35:17 +01:00
kimvde
626c3e9843 Remove fastforward_increment and rewind_increment attributes
This values won't be configurable from the UI anymore once the
DefaultControlDispatcher is removed.

They can be configured in the Player or by using a ForwardingPlayer.

PiperOrigin-RevId: 385113498
2021-07-20 08:33:49 +01:00
kimvde
227f9a3b93 PlayerNotificationManager: add setUseRewind/FastForwardAction
This is a preliminary step to deprecate ControlDispatcher.

PiperOrigin-RevId: 385097270
2021-07-16 11:25:42 +01:00
kimvde
85f3af8864 Use Player commands to enable UI buttons
PiperOrigin-RevId: 384910388
2021-07-15 14:45:44 +01:00
olly
08ac778ad6 Fix package name for UI tests
PiperOrigin-RevId: 384893655
2021-07-15 13:23:42 +01:00
samrobinson
b9ac5a145f Implement a DefaultMediaDescriptionAdapter that uses MediaMetadata.
PiperOrigin-RevId: 384681659
2021-07-14 21:16:20 +01:00
olly
822f6282f1 The sound, vibrate and ticker will only be played once
Android doc:https://developer.android.com/reference/android/app/Notification.Builder#setOnlyAlertOnce(boolean)

PiperOrigin-RevId: 384227580
2021-07-13 10:04:11 +01:00
kimvde
7e6d82237a Rename MEDIA_ITEM to WINDOW is seek commands
This is more correct and is consistent with the Javadoc.

PiperOrigin-RevId: 383808096
2021-07-13 09:56:42 +01:00
samrobinson
d9618b5104 Fix missing word in javadoc.
PiperOrigin-RevId: 383448851
2021-07-09 09:19:01 +01:00
samrobinson
23c884ee2a Add @return to the MediaDescriptionAdapter documentation.
PiperOrigin-RevId: 383268454
2021-07-09 09:08:11 +01:00