Add Player#getTrackSelector()

PiperOrigin-RevId: 310242733
This commit is contained in:
insun 2020-05-06 23:45:19 +01:00 committed by Oliver Woodman
parent 535e14cb4d
commit c7f2df0fd9
7 changed files with 35 additions and 2 deletions

View File

@ -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.

View File

@ -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;
@ -513,6 +514,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) {

View File

@ -1 +0,0 @@
../../proguard-rules.txt

View File

@ -820,6 +820,12 @@ import java.util.concurrent.TimeoutException;
return renderers[index].getTrackType();
}
@Override
@Nullable
public TrackSelector getTrackSelector() {
return trackSelector;
}
@Override
public TrackGroupArray getCurrentTrackGroups() {
return playbackInfo.trackGroups;

View File

@ -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.

View File

@ -1557,6 +1557,13 @@ public class SimpleExoPlayer extends BasePlayer
return player.getRendererType(index);
}
@Override
@Nullable
public TrackSelector getTrackSelector() {
verifyApplicationThread();
return player.getTrackSelector();
}
@Override
public TrackGroupArray getCurrentTrackGroups() {
verifyApplicationThread();

View File

@ -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;
/**
@ -374,6 +375,12 @@ public abstract class StubExoPlayer extends BasePlayer implements ExoPlayer {
throw new UnsupportedOperationException();
}
@Override
@Nullable
public TrackSelector getTrackSelector() {
throw new UnsupportedOperationException();
}
@Override
public TrackGroupArray getCurrentTrackGroups() {
throw new UnsupportedOperationException();