Commit 147020f8 by andrewlewis Committed by Oliver Woodman

Hide player controls when an ad is playing

Also fix an issue where ad timelines with unknown ad period durations
would not be shown in multi-window mode. (The time bar doesn't use the
duration of ad periods, but shows a fix-size indicator instead.)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152666055
parent d8c71df2
......@@ -508,6 +508,10 @@ public class PlaybackControlView extends FrameLayout {
isSeekable = window.isSeekable;
enablePrevious = windowIndex > 0 || isSeekable || !window.isDynamic;
enableNext = (windowIndex < timeline.getWindowCount() - 1) || window.isDynamic;
if (timeline.getPeriod(player.getCurrentPeriodIndex(), period).isAd) {
// Always hide player controls during ads.
hide();
}
}
setButtonEnabled(enablePrevious, previousButton);
setButtonEnabled(enableNext, nextButton);
......@@ -800,7 +804,8 @@ public class PlaybackControlView extends FrameLayout {
}
int periodCount = timeline.getPeriodCount();
for (int i = 0; i < periodCount; i++) {
if (timeline.getPeriod(i, period).durationUs == C.TIME_UNSET) {
timeline.getPeriod(i, period);
if (!period.isAd && period.durationUs == C.TIME_UNSET) {
return false;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment