mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
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
This commit is contained in:
parent
d8c71df255
commit
147020f816
1 changed files with 6 additions and 1 deletions
|
|
@ -508,6 +508,10 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
isSeekable = window.isSeekable;
|
isSeekable = window.isSeekable;
|
||||||
enablePrevious = windowIndex > 0 || isSeekable || !window.isDynamic;
|
enablePrevious = windowIndex > 0 || isSeekable || !window.isDynamic;
|
||||||
enableNext = (windowIndex < timeline.getWindowCount() - 1) || 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(enablePrevious, previousButton);
|
||||||
setButtonEnabled(enableNext, nextButton);
|
setButtonEnabled(enableNext, nextButton);
|
||||||
|
|
@ -800,7 +804,8 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
}
|
}
|
||||||
int periodCount = timeline.getPeriodCount();
|
int periodCount = timeline.getPeriodCount();
|
||||||
for (int i = 0; i < periodCount; i++) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue