Commit de729ecf by andrewlewis Committed by Oliver Woodman

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
parent 2c746c6b
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
([#7344](https://github.com/google/ExoPlayer/issues/7344)). ([#7344](https://github.com/google/ExoPlayer/issues/7344)).
* Improve handling of ad tags with unsupported VPAID ads * Improve handling of ad tags with unsupported VPAID ads
([#7832](https://github.com/google/ExoPlayer/issues/7832)). ([#7832](https://github.com/google/ExoPlayer/issues/7832)).
* Fix a bug that caused multiple ads in an ad pod to be skipped when one
ad in the ad pod was skipped.
### 2.12.1 (2020-10-23) ### ### 2.12.1 (2020-10-23) ###
......
...@@ -1300,12 +1300,17 @@ public final class ImaAdsLoader ...@@ -1300,12 +1300,17 @@ public final class ImaAdsLoader
if (adMediaInfo == null) { if (adMediaInfo == null) {
Log.w(TAG, "onEnded without ad media info"); Log.w(TAG, "onEnded without ad media info");
} else { } else {
@Nullable AdInfo adInfo = adInfoByAdMediaInfo.get(adMediaInfo);
if (playingAdIndexInAdGroup == C.INDEX_UNSET
|| (adInfo != null && adInfo.adIndexInAdGroup < playingAdIndexInAdGroup)) {
for (int i = 0; i < adCallbacks.size(); i++) { for (int i = 0; i < adCallbacks.size(); i++) {
adCallbacks.get(i).onEnded(adMediaInfo); adCallbacks.get(i).onEnded(adMediaInfo);
} }
}
if (configuration.debugModeEnabled) { if (configuration.debugModeEnabled) {
Log.d(TAG, "VideoAdPlayerCallback.onEnded in onTimelineChanged/onPositionDiscontinuity"); Log.d(
TAG, "VideoAdPlayerCallback.onEnded in onTimelineChanged/onPositionDiscontinuity");
}
}
} }
} }
if (!sentContentComplete && !wasPlayingAd && playingAd && imaAdState == IMA_AD_STATE_NONE) { if (!sentContentComplete && !wasPlayingAd && playingAd && imaAdState == IMA_AD_STATE_NONE) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment