diff --git a/library/core/src/main/java/com/google/android/exoplayer2/BasePlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/BasePlayer.java index baa2a767b5..2646cbc035 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/BasePlayer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/BasePlayer.java @@ -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(); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/Player.java b/library/core/src/main/java/com/google/android/exoplayer2/Player.java index d809dcbc88..5f00916892 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/Player.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/Player.java @@ -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.