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
This commit is contained in:
olly 2017-10-17 03:49:49 -07:00 committed by Oliver Woodman
parent f6d0dae50e
commit aa42d3c910

View File

@ -356,17 +356,17 @@ import java.util.concurrent.CopyOnWriteArraySet;
@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