From 4ed7b683833660f6af7d6994a20037ec769ab24c Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:54:00 +0900 Subject: [PATCH] fix(YouTube - Spoof streaming data): On `iOS` clients, livestreams always start from the beginning --- .../shared/patches/spoof/SpoofStreamingDataPatch.java | 10 ++++++++++ .../SpoofStreamingDataSideEffectsPreference.java | 8 +------- .../spoof/streamingdata/BaseSpoofStreamingDataPatch.kt | 10 ++++++++++ .../resources/youtube/settings/host/values/strings.xml | 4 +--- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/SpoofStreamingDataPatch.java b/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/SpoofStreamingDataPatch.java index 21a21379ff..2bb2a233b5 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/SpoofStreamingDataPatch.java +++ b/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/SpoofStreamingDataPatch.java @@ -78,6 +78,16 @@ public static boolean isSpoofingEnabled() { return SPOOF_STREAMING_DATA; } + /** + * Injection point. + */ + public static boolean fixHLSCurrentTime(boolean original) { + if (!SPOOF_STREAMING_DATA) { + return original; + } + return false; + } + /** * Injection point. */ diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/preference/SpoofStreamingDataSideEffectsPreference.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/preference/SpoofStreamingDataSideEffectsPreference.java index 40b64919db..92eec6bcf0 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/preference/SpoofStreamingDataSideEffectsPreference.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/preference/SpoofStreamingDataSideEffectsPreference.java @@ -64,13 +64,7 @@ protected void onPrepareForRemoval() { private void updateUI() { final ClientType clientType = Settings.SPOOF_STREAMING_DATA_TYPE.get(); - - final String summaryTextKey; - if (clientType == ClientType.IOS && Settings.SPOOF_STREAMING_DATA_IOS_SKIP_LIVESTREAM_PLAYBACK.get()) { - summaryTextKey = "revanced_spoof_streaming_data_side_effects_ios_skip_livestream_playback"; - } else { - summaryTextKey = "revanced_spoof_streaming_data_side_effects_" + clientType.name().toLowerCase(); - } + final String summaryTextKey = "revanced_spoof_streaming_data_side_effects_" + clientType.name().toLowerCase(); setSummary(str(summaryTextKey)); setEnabled(Settings.SPOOF_STREAMING_DATA.get()); diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt index a8beb08eb9..956a1818e1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt @@ -12,6 +12,7 @@ import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.shared.extension.Constants.SPOOF_PATH import app.revanced.util.findInstructionIndicesReversedOrThrow import app.revanced.util.fingerprint.definingClassOrThrow +import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall import app.revanced.util.fingerprint.matchOrThrow import app.revanced.util.fingerprint.methodOrThrow import app.revanced.util.getReference @@ -209,6 +210,15 @@ fun baseSpoofStreamingDataPatch( // endregion + // region Fix iOS livestream current time. + + hlsCurrentTimeFingerprint.injectLiteralInstructionBooleanCall( + HLS_CURRENT_TIME_FEATURE_FLAG, + "$EXTENSION_CLASS_DESCRIPTOR->fixHLSCurrentTime(Z)Z" + ) + + // endregion + executeBlock() } diff --git a/patches/src/main/resources/youtube/settings/host/values/strings.xml b/patches/src/main/resources/youtube/settings/host/values/strings.xml index 7f4d6fef1a..4e2aa35f62 100644 --- a/patches/src/main/resources/youtube/settings/host/values/strings.xml +++ b/patches/src/main/resources/youtube/settings/host/values/strings.xml @@ -1903,9 +1903,7 @@ Tap on the continue button and disable battery optimizations." Android TV Android VR Spoofing side effects - "• Livestreams start from the beginning. -• Videos may end 1 second early." - • Videos may end 1 second early. + • Videos may end 1 second early. "• Audio track menu is missing. • Stable volume is not available." "• Audio track menu is missing.