Ignore seekTo if an ad is playing

Issue: #3309

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173114842
This commit is contained in:
andrewlewis 2017-10-23 07:48:44 -07:00 committed by Oliver Woodman
parent 93423aa8d4
commit 43d70bdde9

View File

@ -232,6 +232,18 @@ import java.util.concurrent.CopyOnWriteArraySet;
if (windowIndex < 0 || (!timeline.isEmpty() && windowIndex >= timeline.getWindowCount())) {
throw new IllegalSeekPositionException(timeline, windowIndex, positionMs);
}
if (isPlayingAd()) {
// TODO: Investigate adding support for seeking during ads. This is complicated to do in
// general because the midroll ad preceding the seek destination must be played before the
// content position can be played, if a different ad is playing at the moment.
Log.w(TAG, "seekTo ignored because an ad is playing");
if (pendingSeekAcks == 0) {
for (Player.EventListener listener : listeners) {
listener.onSeekProcessed();
}
}
return;
}
pendingSeekAcks++;
maskingWindowIndex = windowIndex;
if (timeline.isEmpty()) {