Add getRenderer method to ExoPlayer.
This allows access to custom renderers, for example to send messages or to access custom fields and methods. PiperOrigin-RevId: 424878963
This commit is contained in:
parent
9151103968
commit
022b5144b1
@ -41,6 +41,8 @@
|
|||||||
multiple codecs are supported by primary, hardware-accelerated decoders
|
multiple codecs are supported by primary, hardware-accelerated decoders
|
||||||
([#4835](https://github.com/google/ExoPlayer/issues/4835)).
|
([#4835](https://github.com/google/ExoPlayer/issues/4835)).
|
||||||
* Rename `DecoderCounters#inputBufferCount` to `queuedInputBufferCount`.
|
* Rename `DecoderCounters#inputBufferCount` to `queuedInputBufferCount`.
|
||||||
|
* Make `SimpleExoPlayer.renderers` private. Renderers can be accessed via
|
||||||
|
`ExoPlayer.getRenderer`.
|
||||||
* Android 12 compatibility:
|
* Android 12 compatibility:
|
||||||
* Upgrade the Cast extension to depend on
|
* Upgrade the Cast extension to depend on
|
||||||
`com.google.android.gms:play-services-cast-framework:20.1.0`. Earlier
|
`com.google.android.gms:play-services-cast-framework:20.1.0`. Earlier
|
||||||
|
@ -1087,6 +1087,14 @@ public interface ExoPlayer extends Player {
|
|||||||
@C.TrackType
|
@C.TrackType
|
||||||
int getRendererType(int index);
|
int getRendererType(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the renderer at the given index.
|
||||||
|
*
|
||||||
|
* @param index The index of the renderer.
|
||||||
|
* @return The renderer at this index.
|
||||||
|
*/
|
||||||
|
Renderer getRenderer(int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the track selector that this player uses, or null if track selection is not supported.
|
* Returns the track selector that this player uses, or null if track selection is not supported.
|
||||||
*/
|
*/
|
||||||
|
@ -944,6 +944,10 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
return renderers[index].getTrackType();
|
return renderers[index].getTrackType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Renderer getRenderer(int index) {
|
||||||
|
return renderers[index];
|
||||||
|
}
|
||||||
|
|
||||||
public TrackSelector getTrackSelector() {
|
public TrackSelector getTrackSelector() {
|
||||||
return trackSelector;
|
return trackSelector;
|
||||||
}
|
}
|
||||||
|
@ -347,8 +347,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||||||
|
|
||||||
private static final String TAG = "SimpleExoPlayer";
|
private static final String TAG = "SimpleExoPlayer";
|
||||||
|
|
||||||
protected final Renderer[] renderers;
|
private final Renderer[] renderers;
|
||||||
|
|
||||||
private final ConditionVariable constructorFinished;
|
private final ConditionVariable constructorFinished;
|
||||||
private final Context applicationContext;
|
private final Context applicationContext;
|
||||||
private final ExoPlayerImpl player;
|
private final ExoPlayerImpl player;
|
||||||
@ -1349,6 +1348,12 @@ public class SimpleExoPlayer extends BasePlayer
|
|||||||
return player.getRendererType(index);
|
return player.getRendererType(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Renderer getRenderer(int index) {
|
||||||
|
verifyApplicationThread();
|
||||||
|
return player.getRenderer(index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TrackSelector getTrackSelector() {
|
public TrackSelector getTrackSelector() {
|
||||||
verifyApplicationThread();
|
verifyApplicationThread();
|
||||||
|
@ -22,6 +22,7 @@ import com.google.android.exoplayer2.ExoPlayer;
|
|||||||
import com.google.android.exoplayer2.Format;
|
import com.google.android.exoplayer2.Format;
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.PlayerMessage;
|
import com.google.android.exoplayer2.PlayerMessage;
|
||||||
|
import com.google.android.exoplayer2.Renderer;
|
||||||
import com.google.android.exoplayer2.SeekParameters;
|
import com.google.android.exoplayer2.SeekParameters;
|
||||||
import com.google.android.exoplayer2.analytics.AnalyticsCollector;
|
import com.google.android.exoplayer2.analytics.AnalyticsCollector;
|
||||||
import com.google.android.exoplayer2.analytics.AnalyticsListener;
|
import com.google.android.exoplayer2.analytics.AnalyticsListener;
|
||||||
@ -291,6 +292,11 @@ public class StubExoPlayer extends StubPlayer implements ExoPlayer {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Renderer getRenderer(int index) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public TrackSelector getTrackSelector() {
|
public TrackSelector getTrackSelector() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user