Add convenience Player.isCurrentWindowLive method.

PiperOrigin-RevId: 272005632
This commit is contained in:
tonihei 2019-09-30 18:01:22 +01:00 committed by Oliver Woodman
parent dd4f9bcaae
commit 7d8bee799b
2 changed files with 13 additions and 0 deletions

View file

@ -127,6 +127,12 @@ public abstract class BasePlayer implements Player {
return !timeline.isEmpty() && timeline.getWindow(getCurrentWindowIndex(), window).isDynamic;
}
@Override
public final boolean isCurrentWindowLive() {
Timeline timeline = getCurrentTimeline();
return !timeline.isEmpty() && timeline.getWindow(getCurrentWindowIndex(), window).isLive;
}
@Override
public final boolean isCurrentWindowSeekable() {
Timeline timeline = getCurrentTimeline();

View file

@ -961,6 +961,13 @@ public interface Player {
*/
boolean isCurrentWindowDynamic();
/**
* Returns whether the current window is live, or {@code false} if the {@link Timeline} is empty.
*
* @see Timeline.Window#isLive
*/
boolean isCurrentWindowLive();
/**
* Returns whether the current window is seekable, or {@code false} if the {@link Timeline} is
* empty.