Commit c7f2df0f by insun Committed by Oliver Woodman

Add Player#getTrackSelector()

PiperOrigin-RevId: 310242733
parent 535e14cb
......@@ -3,6 +3,7 @@
### dev-v2 (not yet released)
* Core library:
* Add `Player.getTrackSelector` to access track selector from UI module.
* Added `TextComponent.getCurrentCues` because the current cues are no
longer forwarded to a new `TextOutput` in `SimpleExoPlayer`
automatically.
......
......@@ -30,6 +30,7 @@ import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.trackselection.FixedTrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.Log;
import com.google.android.exoplayer2.util.MimeTypes;
......@@ -514,6 +515,12 @@ public final class CastPlayer extends BasePlayer {
}
@Override
@Nullable
public TrackSelector getTrackSelector() {
throw new UnsupportedOperationException();
}
@Override
public void setRepeatMode(@RepeatMode int repeatMode) {
if (remoteMediaClient == null) {
return;
......
../../proguard-rules.txt
\ No newline at end of file
......@@ -821,6 +821,12 @@ import java.util.concurrent.TimeoutException;
}
@Override
@Nullable
public TrackSelector getTrackSelector() {
return trackSelector;
}
@Override
public TrackGroupArray getCurrentTrackGroups() {
return playbackInfo.trackGroups;
}
......
......@@ -33,6 +33,7 @@ import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.text.TextOutput;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer;
import com.google.android.exoplayer2.video.VideoFrameMetadataListener;
......@@ -1189,6 +1190,10 @@ public interface Player {
*/
int getRendererType(int index);
/** Returns the track selector that this player uses. */
@Nullable
TrackSelector getTrackSelector();
/**
* Returns the available track groups.
*/
......@@ -1202,7 +1207,8 @@ public interface Player {
/**
* Returns the current manifest. The type depends on the type of media being played. May be null.
*/
@Nullable Object getCurrentManifest();
@Nullable
Object getCurrentManifest();
/**
* Returns the current {@link Timeline}. Never null, but may be empty.
......
......@@ -1558,6 +1558,13 @@ public class SimpleExoPlayer extends BasePlayer
}
@Override
@Nullable
public TrackSelector getTrackSelector() {
verifyApplicationThread();
return player.getTrackSelector();
}
@Override
public TrackGroupArray getCurrentTrackGroups() {
verifyApplicationThread();
return player.getCurrentTrackGroups();
......
......@@ -30,6 +30,7 @@ import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ShuffleOrder;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import java.util.List;
/**
......@@ -375,6 +376,12 @@ public abstract class StubExoPlayer extends BasePlayer implements ExoPlayer {
}
@Override
@Nullable
public TrackSelector getTrackSelector() {
throw new UnsupportedOperationException();
}
@Override
public TrackGroupArray getCurrentTrackGroups() {
throw new UnsupportedOperationException();
}
......
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