This commit is contained in:
Yuriy Liskov
2020-09-22 20:26:54 +03:00
parent 6a2b4b76e0
commit 28ffbb887c
4 changed files with 9 additions and 17 deletions

View File

@@ -28,8 +28,9 @@ public class ModeSyncManager {
public void restore(Activity activity) {
if (mFormatItem != null) {
mAutoFrameRateHelper.setActivity(activity);
mAutoFrameRateHelper.apply(mFormatItem);
new Handler(Looper.myLooper()).postDelayed(() -> mAutoFrameRateHelper.apply(mFormatItem), 5_000);
//new Handler(Looper.myLooper()).postDelayed(() -> mAutoFrameRateHelper.apply(mFormatItem), 5_000);
}
}
}

View File

@@ -53,9 +53,9 @@ 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) {
Log.d(TAG, "selectVideoTrack: choose custom processing");
return definition;
}
}

View File

@@ -355,19 +355,6 @@ public class TrackSelectorManager implements TrackSelectorCallback {
// enable renderer
mRenderers[rendererIndex].isDisabled = false;
// The group being modified is adaptive and we already have a non-null override.
//if (!selectedBefore) {
// MediaTrack matchedTrack = findBestMatch(track);
//
// setOverride(matchedTrack.rendererIndex, matchedTrack.groupIndex, matchedTrack.trackIndex);
//
// // Update the items with the new state.
// updateSelection(rendererIndex);
//
// // save immediately
// applyOverride(rendererIndex);
//}
MediaTrack matchedTrack = findBestMatch(track);
setOverride(matchedTrack.rendererIndex, matchedTrack.groupIndex, matchedTrack.trackIndex);

View File

@@ -56,14 +56,18 @@ public abstract class LeanbackActivity extends FragmentActivity {
@Override
protected void onStart() {
super.onStart();
mModeSyncManager.restore(this);
mBackgroundManager.onStart();
// we can't do it in the ViewManager because activity may be started from outside
mViewManager.addTopActivity(this.getClass());
}
@Override
protected void onResume() {
super.onResume();
mModeSyncManager.restore(this);
}
@Override
protected void onStop() {
super.onStop();