mirror of
https://github.com/yuliskov/SmartTube.git
synced 2025-05-17 11:25:54 +08:00
media service data refactor
This commit is contained in:
Submodule MediaServiceCore updated: 3af932200d...27e1e8cca7
@ -137,7 +137,6 @@ public class VideoLoaderController extends BasePlayerController implements OnDat
|
||||
restartEngine();
|
||||
} else {
|
||||
YouTubeServiceManager.instance().applyAntiBotFix(); // bot check error?
|
||||
getPlayerTweaksData().enablePersistentAntiBotFix(true);
|
||||
reloadVideo();
|
||||
}
|
||||
}
|
||||
@ -373,11 +372,11 @@ public class VideoLoaderController extends BasePlayerController implements OnDat
|
||||
if (formatInfo.isHistoryBroken()) {
|
||||
// Sign in error (bot check error?)
|
||||
YouTubeServiceManager.instance().applyNoPlaybackFix();
|
||||
YouTubeServiceManager.instance().applyAntiBotFix();
|
||||
getPlayerTweaksData().enablePersistentAntiBotFix(true);
|
||||
//YouTubeServiceManager.instance().applyAntiBotFix();
|
||||
scheduleRebootAppTimer(5_000);
|
||||
} else {
|
||||
scheduleNextVideoTimer(5_000);
|
||||
}
|
||||
|
||||
scheduleNextVideoTimer(5_000);
|
||||
} else if (formatInfo.containsDashVideoFormats() && acceptDashVideoFormats(formatInfo)) {
|
||||
Log.d(TAG, "Found regular video in dash format. Loading...");
|
||||
|
||||
@ -532,7 +531,6 @@ public class VideoLoaderController extends BasePlayerController implements OnDat
|
||||
restartEngine = false;
|
||||
} else if (Helpers.startsWithAny(message, "Response code: 429", "Response code: 400")) {
|
||||
YouTubeServiceManager.instance().applyAntiBotFix();
|
||||
getPlayerTweaksData().enablePersistentAntiBotFix(true);
|
||||
restartEngine = false;
|
||||
} else if (type == PlayerEventListener.ERROR_TYPE_SOURCE && rendererIndex == PlayerEventListener.RENDERER_INDEX_UNKNOWN) {
|
||||
// NOTE: Fixing too many requests or network issues
|
||||
@ -542,7 +540,6 @@ public class VideoLoaderController extends BasePlayerController implements OnDat
|
||||
// "Unexpected ArrayIndexOutOfBoundsException", "Unexpected IndexOutOfBoundsException"
|
||||
// "Response code: 403" (url deciphered incorrectly)
|
||||
YouTubeServiceManager.instance().applyAntiBotFix();
|
||||
getPlayerTweaksData().enablePersistentAntiBotFix(true);
|
||||
restartEngine = false;
|
||||
} else if (type == PlayerEventListener.ERROR_TYPE_RENDERER && rendererIndex == PlayerEventListener.RENDERER_INDEX_SUBTITLE) {
|
||||
// "Response code: 500"
|
||||
|
@ -115,9 +115,7 @@ public class SplashPresenter extends BasePresenter<SplashView> {
|
||||
|
||||
private void runBackgroundTasks() {
|
||||
YouTubeServiceManager.instance().refreshCacheIfNeeded(); // warm up player engine
|
||||
if (PlayerTweaksData.instance(getContext()).isPersistentAntiBotFixEnabled()) {
|
||||
YouTubeServiceManager.instance().applyAntiBotFix();
|
||||
}
|
||||
YouTubeServiceManager.instance().applyAntiBotFix();
|
||||
enableHistoryIfNeeded();
|
||||
Utils.updateChannels(getContext());
|
||||
GDriveBackupWorker.schedule(getContext());
|
||||
|
@ -31,6 +31,7 @@ public class PlayerSettingsPresenter extends BasePresenter<Void> {
|
||||
private final SearchData mSearchData;
|
||||
private final GeneralData mGeneralData;
|
||||
private final SidebarService mSidebarService;
|
||||
private final MediaServiceData mMediaServiceData;
|
||||
private boolean mRestartApp;
|
||||
|
||||
private PlayerSettingsPresenter(Context context) {
|
||||
@ -40,6 +41,7 @@ public class PlayerSettingsPresenter extends BasePresenter<Void> {
|
||||
mSearchData = SearchData.instance(context);
|
||||
mGeneralData = GeneralData.instance(context);
|
||||
mSidebarService = SidebarService.instance(context);
|
||||
mMediaServiceData = MediaServiceData.instance();
|
||||
}
|
||||
|
||||
public static PlayerSettingsPresenter instance(Context context) {
|
||||
@ -237,16 +239,16 @@ public class PlayerSettingsPresenter extends BasePresenter<Void> {
|
||||
private void appendDeveloperCategory(AppDialogPresenter settingsPresenter) {
|
||||
List<OptionItem> options = new ArrayList<>();
|
||||
|
||||
options.add(UiOptionItem.from(getContext().getString(R.string.premium_users_only),
|
||||
option -> MediaServiceData.instance().enablePremiumFix(option.isSelected()),
|
||||
MediaServiceData.instance().isPremiumFixEnabled()));
|
||||
//options.add(UiOptionItem.from(getContext().getString(R.string.premium_users_only),
|
||||
// option -> mMediaServiceData.enablePremiumFix(option.isSelected()),
|
||||
// mMediaServiceData.isPremiumFixEnabled()));
|
||||
|
||||
options.add(UiOptionItem.from(getContext().getString(R.string.playback_buffering_fix),
|
||||
option -> {
|
||||
mPlayerTweaksData.enablePersistentAntiBotFix(option.isSelected());
|
||||
mRestartApp = true;
|
||||
},
|
||||
mPlayerTweaksData.isPersistentAntiBotFixEnabled()));
|
||||
//options.add(UiOptionItem.from(getContext().getString(R.string.playback_buffering_fix),
|
||||
// option -> {
|
||||
// mPlayerTweaksData.enablePersistentAntiBotFix(option.isSelected());
|
||||
// mRestartApp = true;
|
||||
// },
|
||||
// mPlayerTweaksData.isPersistentAntiBotFixEnabled()));
|
||||
|
||||
// Oculus Quest fix: back button not closing the activity
|
||||
options.add(UiOptionItem.from(getContext().getString(R.string.oculus_quest_fix),
|
||||
|
Reference in New Issue
Block a user