Fix handling of postrolls preloading
The IMA SDK now preloads postrolls which is great as we no longer need to rely on detecting buffering at the end of the stream to trigger playing postrolls. Add in the required logic to detect the period transition to playing the postroll. Issue: #7518 PiperOrigin-RevId: 317610682
This commit is contained in:
parent
6d9a1ed639
commit
0ff917ad35
@ -229,6 +229,8 @@
|
|||||||
on seeking to another position
|
on seeking to another position
|
||||||
([#7492](https://github.com/google/ExoPlayer/issues/7492)).
|
([#7492](https://github.com/google/ExoPlayer/issues/7492)).
|
||||||
* Fix incorrect rounding of ad cue points.
|
* Fix incorrect rounding of ad cue points.
|
||||||
|
* Fix handling of postrolls preloading
|
||||||
|
([#7518](https://github.com/google/ExoPlayer/issues/7518)).
|
||||||
|
|
||||||
### 2.11.5 (2020-06-05) ###
|
### 2.11.5 (2020-06-05) ###
|
||||||
|
|
||||||
|
@ -1098,11 +1098,19 @@ public final class ImaAdsLoader implements Player.EventListener, AdsLoader {
|
|||||||
}
|
}
|
||||||
if (!sentContentComplete && !wasPlayingAd && playingAd && imaAdState == IMA_AD_STATE_NONE) {
|
if (!sentContentComplete && !wasPlayingAd && playingAd && imaAdState == IMA_AD_STATE_NONE) {
|
||||||
int adGroupIndex = player.getCurrentAdGroupIndex();
|
int adGroupIndex = player.getCurrentAdGroupIndex();
|
||||||
// IMA hasn't called playAd yet, so fake the content position.
|
if (adPlaybackState.adGroupTimesUs[adGroupIndex] == C.TIME_END_OF_SOURCE) {
|
||||||
fakeContentProgressElapsedRealtimeMs = SystemClock.elapsedRealtime();
|
adsLoader.contentComplete();
|
||||||
fakeContentProgressOffsetMs = C.usToMs(adPlaybackState.adGroupTimesUs[adGroupIndex]);
|
if (DEBUG) {
|
||||||
if (fakeContentProgressOffsetMs == C.TIME_END_OF_SOURCE) {
|
Log.d(TAG, "adsLoader.contentComplete from period transition");
|
||||||
fakeContentProgressOffsetMs = contentDurationMs;
|
}
|
||||||
|
sentContentComplete = true;
|
||||||
|
} else {
|
||||||
|
// IMA hasn't called playAd yet, so fake the content position.
|
||||||
|
fakeContentProgressElapsedRealtimeMs = SystemClock.elapsedRealtime();
|
||||||
|
fakeContentProgressOffsetMs = C.usToMs(adPlaybackState.adGroupTimesUs[adGroupIndex]);
|
||||||
|
if (fakeContentProgressOffsetMs == C.TIME_END_OF_SOURCE) {
|
||||||
|
fakeContentProgressOffsetMs = contentDurationMs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1221,7 +1229,7 @@ public final class ImaAdsLoader implements Player.EventListener, AdsLoader {
|
|||||||
&& positionMs + THRESHOLD_END_OF_CONTENT_MS >= contentDurationMs) {
|
&& positionMs + THRESHOLD_END_OF_CONTENT_MS >= contentDurationMs) {
|
||||||
adsLoader.contentComplete();
|
adsLoader.contentComplete();
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "adsLoader.contentComplete");
|
Log.d(TAG, "adsLoader.contentComplete from content position check");
|
||||||
}
|
}
|
||||||
sentContentComplete = true;
|
sentContentComplete = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user