mirror of
https://github.com/androidx/media.git
synced 2025-05-17 12:39:52 +08:00
Fix issue caused by using ForwardingPlayer and StyledPlayerControlView
StyledPlayerControlView was checking whether the player is an ExoPlayer instance to set the track selector. This means that, if apps were wrapping an ExoPlayer in a ForwardingPlayer (to replace a ControlDispatcher for example), the track selector wasn't set anymore. PiperOrigin-RevId: 391776305
This commit is contained in:
parent
64002f6b9a
commit
4fd7d777b6
@ -1,5 +1,11 @@
|
||||
# Release notes
|
||||
|
||||
### dev-v2 (not yet released)
|
||||
|
||||
* Core Library:
|
||||
* Fix track selection in `StyledPlayerControlView` when using
|
||||
`ForwardingPlayer`.
|
||||
|
||||
### 2.15.0 (2021-08-10)
|
||||
|
||||
* Core Library:
|
||||
|
@ -615,6 +615,11 @@ public class ForwardingPlayer implements Player {
|
||||
player.setDeviceMuted(muted);
|
||||
}
|
||||
|
||||
/** Returns the {@link Player} to which operations are forwarded. */
|
||||
public Player getWrappedPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // Use of deprecated type for backwards compatibility.
|
||||
private static class ForwardingEventListener implements EventListener {
|
||||
|
||||
|
@ -757,6 +757,9 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||
if (player != null) {
|
||||
player.addListener(componentListener);
|
||||
}
|
||||
if (player instanceof ForwardingPlayer) {
|
||||
player = ((ForwardingPlayer) player).getWrappedPlayer();
|
||||
}
|
||||
if (player instanceof ExoPlayer) {
|
||||
TrackSelector trackSelector = ((ExoPlayer) player).getTrackSelector();
|
||||
if (trackSelector instanceof DefaultTrackSelector) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user