Use playAd/stopAd to control position updates switching
Previously the ad/content progress updates were toggled based on whether the player was playing ads or content. After this change, we switch based on whether playAd/stopAd has been called instead. This seems to resolve an issue where occasionally the player would get stuck at the start of an ad, but as I don't have a root cause for that issue and it's only sporadically reproducible I'm not certain this is a reliable fix. Issue: #3525 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179169296
This commit is contained in:
parent
3cc08d0ea3
commit
8e35bffcc3
@ -547,7 +547,7 @@ public final class ImaAdsLoader extends Player.DefaultEventListener implements A
|
|||||||
long elapsedSinceEndMs = SystemClock.elapsedRealtime() - fakeContentProgressElapsedRealtimeMs;
|
long elapsedSinceEndMs = SystemClock.elapsedRealtime() - fakeContentProgressElapsedRealtimeMs;
|
||||||
long fakePositionMs = fakeContentProgressOffsetMs + elapsedSinceEndMs;
|
long fakePositionMs = fakeContentProgressOffsetMs + elapsedSinceEndMs;
|
||||||
return new VideoProgressUpdate(fakePositionMs, contentDurationMs);
|
return new VideoProgressUpdate(fakePositionMs, contentDurationMs);
|
||||||
} else if (playingAd || !hasContentDuration) {
|
} else if (imaAdState != IMA_AD_STATE_NONE || !hasContentDuration) {
|
||||||
return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
|
return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
|
||||||
} else {
|
} else {
|
||||||
return new VideoProgressUpdate(player.getCurrentPosition(), contentDurationMs);
|
return new VideoProgressUpdate(player.getCurrentPosition(), contentDurationMs);
|
||||||
@ -560,7 +560,7 @@ public final class ImaAdsLoader extends Player.DefaultEventListener implements A
|
|||||||
public VideoProgressUpdate getAdProgress() {
|
public VideoProgressUpdate getAdProgress() {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return lastAdProgress;
|
return lastAdProgress;
|
||||||
} else if (!playingAd) {
|
} else if (imaAdState == IMA_AD_STATE_NONE) {
|
||||||
return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
|
return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
|
||||||
} else {
|
} else {
|
||||||
long adDuration = player.getDuration();
|
long adDuration = player.getDuration();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user