From fe2b01c57e21db84a74a7bad814e581aea8eda8b Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Thu, 15 Feb 2018 04:10:53 -0800 Subject: [PATCH] Fix content progress reporting if there is no preroll If there was no preroll and the pending content position was set before the first midroll, the pending content position was never cleared so loading the ad was never triggered. Only set a pending content position if we know that we need to trigger playing an ad for the current position and IMA will poll for an ad (because there is a midroll ad group). Clearing the pending content position happens when IMA pauses content to play the ad. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=185818315 --- .../com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java b/extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java index 312cb046ba..43e3c0d93d 100644 --- a/extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java +++ b/extensions/ima/src/main/java/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.java @@ -889,8 +889,8 @@ public final class ImaAdsLoader extends Player.DefaultEventListener implements A podIndexOffset = adGroupIndexForPosition - 1; } - if (hasMidrollAdGroups(adGroupTimesUs)) { - // IMA will poll the content position, so provide the player's initial position like a seek. + if (adGroupIndexForPosition != C.INDEX_UNSET && hasMidrollAdGroups(adGroupTimesUs)) { + // Provide the player's initial position to trigger loading and playing the ad. pendingContentPositionMs = contentPositionMs; }