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
This commit is contained in:
andrewlewis 2018-02-15 04:10:53 -08:00 committed by Oliver Woodman
parent 1c140603d4
commit fe2b01c57e

View File

@ -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;
}