This commit is contained in:
Yuriy Liskov
2020-09-21 01:20:59 +03:00
parent 6580729462
commit b7d66dccf4
2 changed files with 5 additions and 0 deletions
@@ -158,6 +158,7 @@ public class ExoPlayerController implements EventListener, PlayerController {
for (TrackSelection selection : trackSelections.getAll()) {
if (selection != null) {
Log.d(TAG, "onTracksChanged: format: " + selection.getSelectedFormat());
mEventListener.onTrackChanged(ExoFormatItem.from(selection.getSelectedFormat()));
}
}
@@ -8,6 +8,7 @@ import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelection.Definition;
import com.google.android.exoplayer2.trackselection.TrackSelection.Factory;
import com.liskovsoft.sharedutils.mylogger.Log;
public class RestoreTrackSelector extends DefaultTrackSelector {
private static final String TAG = RestoreTrackSelector.class.getSimpleName();
@@ -52,12 +53,15 @@ public class RestoreTrackSelector extends DefaultTrackSelector {
protected TrackSelection.Definition selectVideoTrack(TrackGroupArray groups, int[][] formatSupports, int mixedMimeTypeAdaptationSupports,
Parameters params, boolean enableAdaptiveTrackSelection) throws ExoPlaybackException {
if (mCallback != null) {
Log.d(TAG, "selectVideoTrack: choose custom processing");
TrackSelection.Definition definition = mCallback.onSelectVideoTrack(groups, params);
if (definition != null) {
return definition;
}
}
Log.d(TAG, "selectVideoTrack: choose default processing");
Definition definition = super.selectVideoTrack(groups, formatSupports, mixedMimeTypeAdaptationSupports, params, enableAdaptiveTrackSelection);
// Don't invoke if track already has been selected by the app