mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Move Player.getTrackSelector to ExoPlayer
PiperOrigin-RevId: 353212567
This commit is contained in:
parent
ba803a2e79
commit
4791900848
7 changed files with 12 additions and 44 deletions
|
|
@ -151,6 +151,7 @@
|
|||
* Add support for playing JPEG motion photos
|
||||
([#5405](https://github.com/google/ExoPlayer/issues/5405)).
|
||||
* Track selection:
|
||||
* Moved `Player.getTrackSelector` to the `ExoPlayer` interface.
|
||||
* Allow parallel adaptation for video and audio
|
||||
([#5111](https://github.com/google/ExoPlayer/issues/5111)).
|
||||
* Simplified enabling tunneling with `DefaultTrackSelector`.
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ 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.Clock;
|
||||
import com.google.android.exoplayer2.util.ListenerSet;
|
||||
|
|
@ -506,12 +505,6 @@ public final class CastPlayer extends BasePlayer {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TrackSelector getTrackSelector() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepeatMode(@RepeatMode int repeatMode) {
|
||||
if (remoteMediaClient == null) {
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer2.trackselection;
|
||||
|
||||
// TODO(b/172315872) Replace @code by @link when Player has been migrated to common
|
||||
/**
|
||||
* The component of a {@code Player} responsible for selecting tracks to be played.
|
||||
*
|
||||
* <p>No Player agnostic track selection is currently supported. Clients should downcast to the
|
||||
* implementation's track selection.
|
||||
*/
|
||||
// TODO(b/172315872) Define an interface for track selection.
|
||||
public interface TrackSelectorInterface {}
|
||||
|
|
@ -449,7 +449,9 @@ public interface ExoPlayer extends Player {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns the track selector that this player uses, or null if track selection is not supported.
|
||||
*/
|
||||
@Nullable
|
||||
TrackSelector getTrackSelector();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ 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.TrackSelectorInterface;
|
||||
import com.google.android.exoplayer2.util.MutableFlags;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.exoplayer2.video.VideoFrameMetadataListener;
|
||||
|
|
@ -1380,12 +1379,6 @@ public interface Player {
|
|||
*/
|
||||
int getRendererType(int index);
|
||||
|
||||
/**
|
||||
* Returns the track selector that this player uses, or null if track selection is not supported.
|
||||
*/
|
||||
@Nullable
|
||||
TrackSelectorInterface getTrackSelector();
|
||||
|
||||
/** Returns the available track groups. */
|
||||
TrackGroupArray getCurrentTrackGroups();
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ import com.google.android.exoplayer2.util.Assertions;
|
|||
* thread. The track selector may call {@link InvalidationListener#onTrackSelectionsInvalidated()}
|
||||
* from any thread.
|
||||
*/
|
||||
public abstract class TrackSelector implements TrackSelectorInterface {
|
||||
public abstract class TrackSelector {
|
||||
|
||||
/**
|
||||
* Notified when selections previously made by a {@link TrackSelector} are no longer valid.
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ControlDispatcher;
|
||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.PlaybackPreparer;
|
||||
|
|
@ -66,6 +67,7 @@ import com.google.android.exoplayer2.trackselection.DefaultTrackSelector.Selecti
|
|||
import com.google.android.exoplayer2.trackselection.MappingTrackSelector.MappedTrackInfo;
|
||||
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.RepeatModeUtil;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
|
|
@ -759,8 +761,11 @@ public class StyledPlayerControlView extends FrameLayout {
|
|||
if (player != null) {
|
||||
player.addListener(componentListener);
|
||||
}
|
||||
if (player != null && player.getTrackSelector() instanceof DefaultTrackSelector) {
|
||||
this.trackSelector = (DefaultTrackSelector) player.getTrackSelector();
|
||||
if (player instanceof ExoPlayer) {
|
||||
TrackSelector trackSelector = ((ExoPlayer) player).getTrackSelector();
|
||||
if (trackSelector instanceof DefaultTrackSelector) {
|
||||
this.trackSelector = (DefaultTrackSelector) trackSelector;
|
||||
}
|
||||
} else {
|
||||
this.trackSelector = null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue