mirror of
https://github.com/samsonjs/media.git
synced 2026-04-01 10:35:48 +00: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. #minor-release PiperOrigin-RevId: 391776305
This commit is contained in:
parent
cbd6527926
commit
1ae879788a
3 changed files with 10 additions and 0 deletions
|
|
@ -9,6 +9,8 @@
|
|||
`com.google.android.exoplayer2.decoder.CryptoException`.
|
||||
* Make `ExoPlayer.Builder` return a `SimpleExoPlayer` instance.
|
||||
* Deprecate `SimpleExoPlayer.Builder`. Use `ExoPlayer.Builder` instead.
|
||||
* Fix track selection in `StyledPlayerControlView` when using
|
||||
`ForwardingPlayer`.
|
||||
* Android 12 compatibility:
|
||||
* Disable platform transcoding when playing content URIs on Android 12.
|
||||
* Add `ExoPlayer.setVideoChangeFrameRateStrategy` to allow disabling of
|
||||
|
|
|
|||
|
|
@ -619,6 +619,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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -756,6 +756,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…
Reference in a new issue