380 Commits

Author SHA1 Message Date
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
andrewlewis
4289112947 Fix buildForAdsResponse
PiperOrigin-RevId: 340198099
2020-11-02 23:01:07 +00:00
andrewlewis
32b710712e Split AdTagLoader out of ImaAdsLoader
In a later change ImaAdsLoader will use multiple AdTagLoaders.

This change shouldn't have any substantial changes in behavior (it's almost
entirely moving code around). An exception is that ImaSdkSettings is configured
when making a request rather than at construction time.

Issue: #3750
PiperOrigin-RevId: 339891712
2020-11-02 23:00:48 +00:00
andrewlewis
27707e9c65 Clean up deprecated ad tag handling
PiperOrigin-RevId: 339890695
2020-11-02 23:00:39 +00:00
andrewlewis
df19725d58 Move more IMA extension utils into ImaUtil
These symbols will be referenced from AdTagLoader too in a later change.

PiperOrigin-RevId: 339889990
2020-11-02 23:00:29 +00:00
andrewlewis
de729ecf3a Fix skipping behavior in ad pods
ImaAdsLoader notified onEnded whenever an ad finished playing, but when an ad
is skipped in an ad pod we'd receive a playAd call before the player
discontinuity for skipping to the next ad. Fix this behavior by checking that
IMA's playing ad matches the player's playing ad before notifying onEnded.

#minor-release

PiperOrigin-RevId: 339424910
2020-11-02 22:58:06 +00:00
andrewlewis
1c4653f7ee Improve progress update logs
Add logging for ad progress and switch from deprecated getters to new
millisecond getters.

PiperOrigin-RevId: 339226534
2020-11-02 22:57:37 +00:00
andrewlewis
78940445fe Improve handling of VPAID ads
Issue: #7832
PiperOrigin-RevId: 339087555
2020-11-02 22:56:39 +00:00
andrewlewis
16c60ecf4b Upgrade IMA SDK dependency to 3.21.0
Call the new method AdsLoader.release() to allow the IMA SDK to dispose of its
WebView.

Issue: #7344
PiperOrigin-RevId: 339022162
2020-11-02 22:56:02 +00:00
andrewlewis
2ada01c1e7 Allow enabling IMA ext debug mode programmatically
PiperOrigin-RevId: 337824945
2020-10-20 14:50:59 +01:00
andrewlewis
35f7e7f609 Upgrade IMA SDK dependency to 3.20.1
This brings in a fix for companion ads rendering when targeting API 29.

Issue: #6432
PiperOrigin-RevId: 337279054
2020-10-17 01:34:52 +01:00
bachinger
75513e581f Use Math.round(double) to avoid result being limited to Integer.MAX_INT
Issue: #8067
PiperOrigin-RevId: 337122011
2020-10-17 01:34:24 +01:00
ibaker
2371b024dd Switch to an 'api' dependency on Guava
The 'implementation' dependency causes problems when resolving
ListenableFuture in contexts that also include the
com.google.guava:listenablefuture:1.0 dependency.

Issue: #7905
Issue: #7997
Issue: #7993
PiperOrigin-RevId: 337093024
2020-10-17 01:34:15 +01:00
andrewlewis
eccc00bca8 Add a way to override ad media MIME types
Issue: #7961
PiperOrigin-RevId: 337069152
2020-10-17 01:34:06 +01:00
andrewlewis
cfe267a568 Encapsulate ImaAdsLoader configuration in a class
This will reduce the amount of boilerplate required to pass the configuration
values around (especially in a planned future change when logic is factored out
of ImaAdsLoader).

PiperOrigin-RevId: 337058355
2020-10-17 01:33:56 +01:00
andrewlewis
39277ebe95 Pass ad tags via AdsMediaSource
This is in preparation for supporting playlists of ads media sources using
ImaAdsLoader.

Existing ways of passing ad tags should still function but are deprecated (and
won't be supported with playlists).

Issue: #3750
PiperOrigin-RevId: 335618364
2020-10-06 14:31:50 +01:00
andrewlewis
41192ee046 Allow apps to add a VideoAdPlayerCallback
Issue: #7944
PiperOrigin-RevId: 335012643
2020-10-06 14:31:23 +01:00
andrewlewis
c35787a08f Add ImaUtil for IMA extension utilities
PiperOrigin-RevId: 334567234
2020-09-30 11:55:52 +01:00
andrewlewis
8728706c6e Use Builder in ImaAdsLoader constructor
PiperOrigin-RevId: 334562209
2020-09-30 11:55:44 +01:00
andrewlewis
151a3d3bf5 Fix position reporting with fetch errors
On receiving a fetch error for an ad that would otherwise play based on an
initial/seek position, the pending content position wasn't cleared which meant
that position reporting was broken after a fetch error. Fix this by always
clearing the pending position (if there was a pending position that will have
triggered the fetch error).

Also deduplicate the code for handling empty ad groups (fetch errors)
and ad group load errors.

Issue: #7956
PiperOrigin-RevId: 334113131
2020-09-30 11:55:09 +01:00
olly
b999977c9d Dev guide: Copy editing
Also changed the links that describe configuring the
player for ad insertion to link to the ads page.

PiperOrigin-RevId: 331349846
2020-09-13 00:02:32 +01:00
bachinger
99cdf2ca4d MediaItemify the IMA extension README and the ads page in dev guide
PiperOrigin-RevId: 331155539
2020-09-11 17:30:54 +01:00
andrewlewis
156166f57c Fix handling of empty ad groups at non-integer cue points
Issue: #7889
PiperOrigin-RevId: 331149688
2020-09-11 17:30:43 +01:00
olly
cdcb30ed21 Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:01:15 +01:00
andrewlewis
033232784a Improve DEBUG VideoProgressUpdate logging
PiperOrigin-RevId: 330918689
2020-09-11 13:24:22 +01:00
andrewlewis
06de13ecae Add a setter for ad error listeners
This is useful because ImaAdsLoader.getAdsLoader() can now return null
(before ads have been requested), and it avoids the app needing to get
an AdsManager to attach its listener.

PiperOrigin-RevId: 330907051
2020-09-11 13:23:54 +01:00
olly
b2b08ade99 Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:41:51 +01:00
olly
04f67e4adc Simplify DefaultMediaSourceFactory ad configuration
- Use a setter, which is consistent with how other optional
  components are passed.
- Remove nesting where a provider provides another provider.
  Since AdSupportProvider then only provides one thing, it
  can be renamed to AdsLoaderProvider, which more clearly
  expresses what it provides.

PiperOrigin-RevId: 330396334
2020-09-07 20:43:41 +01:00
andrewlewis
47561f200f Fix handling of incompatible VPAID ads
Issue: #7832
PiperOrigin-RevId: 329497598
2020-09-07 20:40:13 +01:00
andrewlewis
acc8453628 Add support for audio-only ad display containers
Issue: #7689
PiperOrigin-RevId: 325752377
2020-08-17 16:05:56 +01:00
andrewlewis
9392dff225 Call VideoAdPlayerCallback.onLoaded
This callback was not notified before, which could theoretically lead to ad
loading timing out. In practice it doesn't currently happen because the timeout
appears to start when the ad cue point is reached, not when loadAd is called.

We notify onLoaded when the ad media period is prepared (for HTML5 the
recommendation is to notify on the HTMLMediaElement 'canplay' event, which this
roughly corresponds to).

PiperOrigin-RevId: 324568407
2020-08-07 18:58:31 +01:00
andrewlewis
f24ba73b80 Add setter for companion ad slots
PiperOrigin-RevId: 322965540
2020-07-27 23:58:30 +01:00
andrewlewis
7fce04a67f Depend on the IMA extension in noExtensions variant
Also use the cronet extension in the demo app.

PiperOrigin-RevId: 322108530
2020-07-24 10:39:03 +01:00
ibaker
b48a762f20 Migrate overrides of deprecated AdsViewProvider.getAdOverlayViews
PiperOrigin-RevId: 321121735
2020-07-24 10:31:31 +01:00
kimvde
702568c3b6 Remove some occurrences of dummy in core library
Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 320606558
2020-07-13 14:03:54 +01:00
andrewlewis
3214851fbb Migrate off deprecated IMA SDK APIs
AdDisplayContainer now takes the video ad player at construction time,
and obstructions are registered/unregistered via a new method. Also
'content complete' is now notified via ad callbacks rather than the
AdsLoader.

PiperOrigin-RevId: 320567666
2020-07-13 14:02:52 +01:00
andrewlewis
a8f1cdcfd7 Upgrade IMA SDK to 3.19.4
This brings in a fix for the IMA SDK ignoring the media load timeout.

Issue: #7170
PiperOrigin-RevId: 320557386
2020-07-10 09:09:48 +01:00
andrewlewis
4c75339ee8 Tidy ImaAdsLoader method ordering
Also move implementations of some VideoAdPlayer callback methods into
their own methods. This is a no-op change except for expanding the
scope of some defensive try blocks associated with those callbacks.

Also add static imports for Math.max and Assertions helpers methods.

PiperOrigin-RevId: 319958087
2020-07-08 13:55:29 +01:00
andrewlewis
040ff47e82 Upgrade IMA to 3.19.2
PiperOrigin-RevId: 319764381
2020-07-06 16:46:58 +01:00
andrewlewis
eb9de7a120 Fix postroll content complete notifications
On reaching the end of the content we would notify content complete
and skip unplayed ads, causing a timeline change. That timeline change
was handled in a way that caused a further timeline change in the
2.11.6 release, where we don't yet deduplicate no-op Timeline changes,
causing repeated timeline changes indefinitely.

At tip-of-tree, the timeline wouldn't refresh repeatedly. However the
code for sending content complete at the point of transitioning to
play a preloaded postroll ad was not correct in that it didn't mark
previous ads as skipped. Instead they happened to be marked as
skipped later on due to the timeline change handling content
completion code triggering again.

Fix this by only marking ads as skipped when content completes once,
to avoid the duplicate timeline change, and moving the skipped ad
marking so it happens in the same place as notifying content complete.

PiperOrigin-RevId: 318454908
2020-06-26 13:46:53 +01:00
olly
21b07ba4db Fix broken @value Javadoc
PiperOrigin-RevId: 318077821
2020-06-26 11:13:57 +01:00