Commit 91a491ea by bachinger Committed by Oliver Woodman

Add getMediaItemCount() and getMediaItemAt(int)

PiperOrigin-RevId: 331211708
parent bff7ac0d
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
### dev-v2 (not yet released) ### dev-v2 (not yet released)
* `Player`:
* add `getMediaItemCount()` and `getMediaItemAt(int)`.
* Track selection: * Track selection:
* Add option to specify multiple preferred audio or text languages. * Add option to specify multiple preferred audio or text languages.
* Data sources: * Data sources:
......
...@@ -186,6 +186,16 @@ public abstract class BasePlayer implements Player { ...@@ -186,6 +186,16 @@ public abstract class BasePlayer implements Player {
} }
@Override @Override
public int getMediaItemCount() {
return getCurrentTimeline().getWindowCount();
}
@Override
public MediaItem getMediaItemAt(int index) {
return getCurrentTimeline().getWindow(index, window).mediaItem;
}
@Override
@Nullable @Nullable
public final Object getCurrentManifest() { public final Object getCurrentManifest() {
Timeline timeline = getCurrentTimeline(); Timeline timeline = getCurrentTimeline();
......
...@@ -1284,6 +1284,12 @@ public interface Player { ...@@ -1284,6 +1284,12 @@ public interface Player {
@Nullable @Nullable
MediaItem getCurrentMediaItem(); MediaItem getCurrentMediaItem();
/** Returns the number of {@link MediaItem media items} in the playlist. */
int getMediaItemCount();
/** Returns the {@link MediaItem} at the given index. */
MediaItem getMediaItemAt(int index);
/** /**
* Returns the duration of the current content window or ad in milliseconds, or {@link * Returns the duration of the current content window or ad in milliseconds, or {@link
* C#TIME_UNSET} if the duration is not known. * C#TIME_UNSET} if the duration is not known.
......
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