320 Commits

Author SHA1 Message Date
bachinger
a9913e5410 Add the media item to PositionInfo
PiperOrigin-RevId: 392914515
2021-08-26 11:03:40 +01:00
krocard
9fad5f4130 Add Track selection to the Player API
This cl doesn't implement completely the API for
`ExoPlayerImpl` as
`onTrackSelectionParametersChanged` is not called.

The follow up cl adds `TrackSelectionParameters` in PlaybackInfo
to correctly propagate the change event and mask it.

Additionally `TrackSelectionParameters` is serialized as a Parcelable
for now. It is transitioned to bundleable in a follow up cl.

PiperOrigin-RevId: 392899918
2021-08-26 10:58:27 +01:00
andrewlewis
ce4c8e405c Add some range annotations
PiperOrigin-RevId: 391253301
2021-08-17 15:48:10 +01:00
olly
7e8ba03147 Deprecate final non-nested Factory classes in upstream
PiperOrigin-RevId: 389661768
2021-08-09 20:07:24 +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
aquilescanta
72b416c617 Remove ExoPlaybackException factory method that doesn't take errorCode
PiperOrigin-RevId: 384442821
2021-07-14 12:08:53 +01:00
olly
a632acc1d0 Fix 1 ErrorProneStyle finding:
* @ImaAdState is not a TYPE_USE annotation, so should appear before any modifiers and after Javadocs.
  (see go/java-style#s4.8.5-annotations)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Suggest a fix on the CL (go/how-to-suggest-fix).
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if the change looks generally problematic.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/media/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/media/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

PiperOrigin-RevId: 383121587
2021-07-09 09:01:04 +01:00
olly
dea52048cb Bump dependency versions
PiperOrigin-RevId: 382277352
2021-06-30 13:53:01 +01:00
olly
7aaba1ffe5 Migrate usage of Player.EventListener to Player.Listener
PiperOrigin-RevId: 381837274
2021-06-30 13:43:51 +01:00
aquilescanta
1a8592c5c0 Add Player.Listener.onPlayerErrorChanged
Equivalent to onPlayerError, except it's also called for null.

PiperOrigin-RevId: 381015336
2021-06-30 13:17:49 +01:00
aquilescanta
fc1d3dd192 Make onPlayerError take a PlaybackException
PiperOrigin-RevId: 380174672
2021-06-21 22:15:01 +01:00
olly
a3dbd61239 Remove obsolete Checker Framework suppression strings
More information: go/checker-3130-lsc

Tested:
    Some test failures are present, but the CL author has decided to mail the change anyway
PiperOrigin-RevId: 379622938
2021-06-21 21:56:37 +01:00
olly
4b30cca914 Update @SuppressWarnings annotations for go/nullness diagnostics
in preparation for upgrading the version of the Checker Framework in google3.

More information: go/checker-3110-lsc

PiperOrigin-RevId: 377925828
2021-06-08 13:02:47 +01:00
tonihei
0d0ccadc83 Add getter for ad groups in AdPlaybackState.
This allows to decouple the data structure from the access. In
a future change, this allows to completely remove old ad groups
(e.g. for live streams where the number of groups would otherwise
grow forever).

Also move the time into the group itself for better encapsulation.

PiperOrigin-RevId: 376170408
2021-05-27 18:48:40 +01:00
bachinger
4c1a294b2e Format Java source files
PiperOrigin-RevId: 372127633
2021-05-06 13:32:25 +01:00
bachinger
39ac09e7c6 Add @DoNotInstrument for unit test classes of extensions
PiperOrigin-RevId: 372101509
2021-05-06 13:32:05 +01:00
krocard
3dc6cf6bec Deprecate EventListener in favor of Listener
#minor-release

PiperOrigin-RevId: 371348520
2021-04-30 18:56:35 +01:00
christosts
0616c0d118 Add Player.getAvailableCommands()
Add method getAvailableCommands() in Player interface to return
the available commands. Method isCommandAvailable() moved to
BasePlayer since it can be implelented by calling
getAvailableCommands().

PiperOrigin-RevId: 370059328
2021-04-26 18:01:03 +01:00
krocard
4fc4ddbc6a Move AudioComponent to ExoPlayer leaving key methods in Player
PiperOrigin-RevId: 368413660
2021-04-15 10:51:05 +01:00
andrewlewis
3ea694b1fb Upgrade IMA SDK dependency to 3.23.0
This brings in another fix for `NullPointerExceptions` within `WebView` callbacks in the IMA SDK, related to companion ads.

Issue: #8447

#minor-release

PiperOrigin-RevId: 367591047
2021-04-09 13:19:14 +01:00
olly
199b9d1689 Convergence: Continue decoupling UI from Core
Move AdsLoader inner classes that are also required by
the UI module into common.

PiperOrigin-RevId: 367414679
2021-04-09 13:19:07 +01:00
bachinger
dc4148d576 Add positions and new reasons to onPositionDiscontinuity
PiperOrigin-RevId: 364861539
2021-03-24 19:56:25 +00:00
andrewlewis
6a6c70c7c1 Upgrade IMA SDK dependency to 3.22.3
This brings in a fix for `NullPointerExceptions` within `WebView` callbacks in
the IMA SDK.

Issue: #8447
PiperOrigin-RevId: 363627446
2021-03-24 18:03:58 +00:00
andrewlewis
93c9c7a072 Don't update the ad group count when releasing ImaAdsLoader
`ImaAdsLoader` clears its `AdPlaybackState` when it's released but this could
cause `AdsMediaSource` to look up information in the ad playback state that is
no longer in bounds.

Issue: #8693

#minor-release

PiperOrigin-RevId: 362556286
2021-03-15 19:14:34 +00:00
kimvde
4a6859e5e2 Replace MutableFlags by immutable class
PiperOrigin-RevId: 362043183
2021-03-12 10:42:02 +00:00
krocard
589f50fb22 Move renderer from Player to ExoPlayer
The concept of Renderers is not needed in the
Player interface. Move it to ExoPlayer.

This should not break most users as they use SimpleExoPlayer.

PiperOrigin-RevId: 359220977
2021-02-24 15:46:35 +00:00
andrewlewis
e009322edd Fix seeking to a non-zero position in a preloaded ad item
`ImaAdsLoader` will preload the first ad of a subsequent media item, but the
preloaded ad might not actually play because the user could seek to a non-zero
position in that media item (which could trigger playback of a midroll, not the
preroll). In this case, playback would get stuck because the midroll ad
expected to play after the seek would never load, because the IMA SDK expected
the preroll to play first.

Fix this behavior by discarding the preloaded ad break. If there isn't a seek,
the transition to the next media item is still seamless.

#minor-release

PiperOrigin-RevId: 357682510
2021-02-19 10:57:00 +00:00
andrewlewis
f74918a674 Fix ad tag loader period index
Previously it was safe to query the first period in the timeline, but
now we support using the ads loader in concatenations we need to use
the current period index instead.

#minor-release

PiperOrigin-RevId: 357578003
2021-02-19 10:56:19 +00:00
andrewlewis
41c94edcc2 Add a method to focus the 'skip ad' button, if shown
Issue: #8565

#minor-release

PiperOrigin-RevId: 356691251
2021-02-11 12:05:39 +00:00
andrewlewis
846bb94ec4 Handle loading the same ad more than once
Also allow the player's prepared ad media period durations array to exceed the
length of the loaded ad URIs array, as it's possible for the player to buffer
an ad media period fully at the point where it's known that an ad is coming up
but its URI is still unknown.

#minor-release

PiperOrigin-RevId: 356249284
2021-02-09 13:59:24 +00:00
olly
2b24e88726 Pass full locale code to IMA
IMA can now handle the full locale code properly.

PiperOrigin-RevId: 354528700
2021-02-01 18:10:46 +00:00
tonihei
d1faf713af Use Clock to create Handler in ListenerSet.
This ensures the Handler is governed by this clock.

PiperOrigin-RevId: 353011555
2021-01-22 16:21:27 +00:00
andrewlewis
f2057156d1 Time out ad preloading for initial seek
The IMA SDK currently notifies `CONTENT_RESUME_REQUESTED` then
`CONTENT_PAUSE_REQUESTED` quickly afterwards when playing an ad for an initial
seek. This triggered the logic to skip VPAID ads added for Issue: #7832,
causing the ad to be skipped.

This change reverts the fix for that issue and extends the ad preload timeout
logic to cover the case of an initial seek as well. Incompatible VPAID ads will
still be skipped but only after the preload delay (this seems fine given that
they are documented not to be supported, and we are just making the failure
mode less bad on a best-effort basis!).

Issue: #8428
Issue: #7832
PiperOrigin-RevId: 353011270
2021-01-22 16:21:18 +00:00
andrewlewis
e3620ed646 Upgrade IMA SDK dependency to 3.22.0
Issue: #7344
Issue: #8339
PiperOrigin-RevId: 351212047
2021-01-12 08:46:06 +00:00
andrewlewis
e791e3ce54 Fix checking imaAdMediaInfo nullness
It's intended to log a warning in this case, rather than throw.

Issue: #8290

#minor-release

PiperOrigin-RevId: 347790527
2020-12-17 11:25:53 +00:00
andrewlewis
0633778c70 Fix handling of repeated ads identifiers
Previously the `AdTagLoader` only had one listener which meant that updates
that should affect all periods with matching identifiers in the timeline only
affected the last-attached one. Fix this by having `AdTagLoader` track all its
listeners.

Issue: #3750
PiperOrigin-RevId: 347571323
2020-12-17 11:25:53 +00:00
andrewlewis
4139ee5c52 Improve ad loader listening in ImaAdsLoaderTest
It is more realistic for each source to have its own listener and to share
`TimelineWindowDefinition`s between them.

Issue: #3750
PiperOrigin-RevId: 347398769
2020-12-17 11:25:53 +00:00
andrewlewis
6796c4d01c Add a setting for enabling continuous playback
Issue: #3750
PiperOrigin-RevId: 346079830
2020-12-14 10:14:55 +00:00
tonihei
87cd644d00 Add remaining proguard config tests.
This ensures we have full test coverage for proguard configs now.
The only configs not covered by tests are:
 - IMA and OkHttp which copy recommended configs from the respective
   library. I couldn't reproduce failures by removing them (and thus
   couldn't write a test that ensures they are correct).
 - Some dontwarn lines that just suppress warnings.

In addition, this change fixes a couple of related issues:
 - Moved AV1 proguard config to correct module.
 - Removed mentioning of deprecated ExtractorMediaSource from README
 - Suppressed warning from IMA code that prevent proguarding under
   strict rules
 - Fixed wrong proguard exclusion in VP9 module.
 - Moved FLAC exclusion (DefaultExtractorsFactory) to correct module.
 - Added AlertDialog suppression for de-jetified code.
 - Removed unusued dependency from UI module that causes large APK
   size increase.

#exofixit
#minor-release

PiperOrigin-RevId: 344427532
2020-11-27 11:08:34 +00:00
andrewlewis
ee36e648e3 Fix ad progress updates after rebuffering an ad
Issue: #8239

#exofixit
#minor-release

PiperOrigin-RevId: 344211877
2020-11-27 11:06:35 +00:00
tonihei
d4e1904604 Rollback of 483a350e84
*** Original commit ***

Suppress warnings in preparation for Checker Framework 3.7.1 upgrade.

LSC: go/checker-lsc

Tested:
    TAP train for global presubmit queue
    http://test/OCL:342788973:BASE:342817196:1605636478036:6c558c0c

***

PiperOrigin-RevId: 343895651
2020-11-24 16:02:45 +00:00
olly
64d11a98ec Reference IMA language code bug
PiperOrigin-RevId: 343883034
2020-11-24 16:02:37 +00:00
andrewlewis
05f6d24821 Add support for ad playlists with ImaAdsLoader
Issue: #3750
PiperOrigin-RevId: 343878310
2020-11-24 16:02:17 +00:00
olly
689e89e5f3 Localize IMA based on device locale by default
#exofixit

PiperOrigin-RevId: 343871061
2020-11-24 16:02:07 +00:00
olly
483a350e84 Suppress warnings in preparation for Checker Framework 3.7.1 upgrade.
PiperOrigin-RevId: 342999390
2020-11-18 18:40:06 +00:00
andrewlewis
ae4cf9f1da Clean up AdTagLoader and ImaAdsLoader
In preparation for adding support for ads in playlists:
- Make releasing a no-op if the instance was already released
- Remove null checks on non-null `adDisplayContainer` and `adsLoader`
- Move initializing the ads manager into a private method as it will need to be
  called from two places soon.
- Misc other cleanup.

Issue: #3750
PiperOrigin-RevId: 341021493
2020-11-06 16:35:14 +00:00
andrewlewis
764e5e8141 Expose the ads identifier in the Timeline period
Issue: #3750
PiperOrigin-RevId: 341021084
2020-11-06 16:35:06 +00:00
andrewlewis
0c301fefa8 Pass AdsMediaSource to other AdsLoader methods
Issue: #3750
PiperOrigin-RevId: 341020676
2020-11-06 16:34:57 +00:00
andrewlewis
5fd1601f91 Signal an ads identifier to the AdsLoader
In a later change, the AdPlaybackState will include the playing adsId (set by
the AdsLoader) and the ads loader will use this to determine what ad
information is associated with the playing/next periods, to allow loading ads
in playlists.

Apps can continue to pass just a URI for an ad tag with their MediaItem, in
which case the associated playlist will request that ad tag just and the same
state will be used for all occurrences of the ad tag.

This change has breaking changes to the AdsLoader interface and removes
deprecated ways of passing the ad tag, as it's very likely to go into a major
release anyway and not needing to handle the deprecated cases simplifies
ImaAdsLoader.

Issue: #3750
PiperOrigin-RevId: 340438580
2020-11-06 16:32:31 +00:00
andrewlewis
57c53c5ac4 Fix ImaPlaybackTest
This test is not run in presubmit as it was too flaky, and is currently broken
due to assets moving.

Also migrate off ImaPlaybackTest off deprecated APIs.

#minor-release

PiperOrigin-RevId: 340405666
2020-11-06 16:32:11 +00:00