From 2c10e6f1c3fd1692d8db3d16355648aab92e66f7 Mon Sep 17 00:00:00 2001 From: olly Date: Tue, 17 Oct 2017 03:49:49 -0700 Subject: [PATCH] We're not playing an ad if the timeline is empty. Issue: #3334 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=172447125 --- .../java/com/google/android/exoplayer2/ExoPlayerImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java index 22226604691..6bd6cd4795c 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java @@ -386,17 +386,17 @@ public boolean isCurrentWindowSeekable() { @Override public boolean isPlayingAd() { - return pendingSeekAcks == 0 && playbackInfo.periodId.isAd(); + return !timeline.isEmpty() && pendingSeekAcks == 0 && playbackInfo.periodId.isAd(); } @Override public int getCurrentAdGroupIndex() { - return pendingSeekAcks == 0 ? playbackInfo.periodId.adGroupIndex : C.INDEX_UNSET; + return isPlayingAd() ? playbackInfo.periodId.adGroupIndex : C.INDEX_UNSET; } @Override public int getCurrentAdIndexInAdGroup() { - return pendingSeekAcks == 0 ? playbackInfo.periodId.adIndexInAdGroup : C.INDEX_UNSET; + return isPlayingAd() ? playbackInfo.periodId.adIndexInAdGroup : C.INDEX_UNSET; } @Override