From 14daa8a80ee1a78d1fdef6ca716b35baaa880402 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 21 Aug 2024 00:37:04 -0400 Subject: [PATCH 1/9] fix(YouTube - Spoof client): Use VP9 with iOS only if device has hardware decoding --- .../patches/youtube/misc/fix/playback/SpoofClientPatch.kt | 1 + src/main/resources/addresources/values/strings.xml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt index 1c097fa49e..114f9f9f11 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt @@ -119,6 +119,7 @@ object SpoofClientPatch : BytecodePatch( preferences = setOf( SwitchPreference("revanced_spoof_client"), SwitchPreference("revanced_spoof_client_use_ios"), + SwitchPreference("revanced_spoof_client_ios_force_avc1") ), ), ) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index 863f956c08..daa904fed6 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1141,6 +1141,9 @@ This is because Crowdin requires temporarily flattening this file and removing t Spoof client to iOS Client is currently spoofed to iOS\n\nSide effects include:\n• HDR video may not be available\n• Watch history does not work with a brand account Client is currently spoofed to Android VR\n\nSide effects include:\n• No HDR video\n• Kids videos do not playback\n• Paused videos can randomly resume\n• Low quality Shorts seekbar thumbnails\n• Download action button is hidden\n• End screen cards are hidden + Force iOS AVC1 + iOS video codec is AVC1 + iOS video codec is AVC1, VP9, or AV1 Spoof client thumbnails not available (API timed out) Spoof client thumbnails temporarily not available: %s From 2ea2be4afa406ce0ea2def9f6f66017983b9fe0a Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 21 Aug 2024 01:19:53 -0400 Subject: [PATCH 2/9] refactor: Use enum for client type, move side effects to separate preference due to excessive text clipping in foreign languages --- .../misc/fix/playback/SpoofClientPatch.kt | 16 ++++++++++++---- .../resources/addresources/values/arrays.xml | 11 +++++++++++ .../resources/addresources/values/strings.xml | 11 ++++++++--- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt index 114f9f9f11..366b1589f7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt @@ -14,6 +14,8 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patches.all.misc.resources.AddResourcesPatch +import app.revanced.patches.shared.misc.settings.preference.ListPreference +import app.revanced.patches.shared.misc.settings.preference.NonInteractivePreference import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen import app.revanced.patches.shared.misc.settings.preference.SwitchPreference import app.revanced.patches.youtube.misc.backgroundplayback.BackgroundPlaybackPatch @@ -118,10 +120,16 @@ object SpoofClientPatch : BytecodePatch( sorting = PreferenceScreen.Sorting.UNSORTED, preferences = setOf( SwitchPreference("revanced_spoof_client"), - SwitchPreference("revanced_spoof_client_use_ios"), - SwitchPreference("revanced_spoof_client_ios_force_avc1") - ), - ), + ListPreference("revanced_spoof_client_type", + summaryKey = null, + entriesKey = "revanced_spoof_client_type_entries", + entryValuesKey = "revanced_spoof_client_type_entry_values" + ), + SwitchPreference("revanced_spoof_client_ios_force_avc1"), + NonInteractivePreference("revanced_spoof_client_about_android_ios"), + NonInteractivePreference("revanced_spoof_client_about_android_vr") + ) + ) ) // region Block /initplayback requests to fall back to /get_watch requests. diff --git a/src/main/resources/addresources/values/arrays.xml b/src/main/resources/addresources/values/arrays.xml index f8f2b42183..95c46f9353 100644 --- a/src/main/resources/addresources/values/arrays.xml +++ b/src/main/resources/addresources/values/arrays.xml @@ -97,6 +97,17 @@ END + + + @string/revanced_spoof_client_type_entry_1 + @string/revanced_spoof_client_type_entry_2 + + + + IOS + ANDROID_VR + + @string/revanced_video_quality_default_entry_1 diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index daa904fed6..a9308df0e3 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1138,9 +1138,14 @@ This is because Crowdin requires temporarily flattening this file and removing t Client is spoofed Client is not spoofed\n\nVideo playback may not work Turning off this setting may cause video playback issues. - Spoof client to iOS - Client is currently spoofed to iOS\n\nSide effects include:\n• HDR video may not be available\n• Watch history does not work with a brand account - Client is currently spoofed to Android VR\n\nSide effects include:\n• No HDR video\n• Kids videos do not playback\n• Paused videos can randomly resume\n• Low quality Shorts seekbar thumbnails\n• Download action button is hidden\n• End screen cards are hidden + Spoof client type + iOS + Android VR + iOS spoofing side effects + • HDR video may not be available\n• Watch history does not work with a brand account + Android VR spoofing side effects + • No HDR video\n• Kids videos do not playback\n• Paused videos can randomly resume\n• Low quality Shorts seekbar thumbnails\n• Download action button is hidden\n• End screen cards are hidden + Client is currently spoofed to Android VR\n\n Force iOS AVC1 iOS video codec is AVC1 iOS video codec is AVC1, VP9, or AV1 From c2bbaed614cd3ad63b23dbd9cca81279fee1ea50 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:55:33 -0400 Subject: [PATCH 3/9] fix: It seems to always use VP9/AV1 if not forced to AVC1 --- src/main/resources/addresources/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index a9308df0e3..e2572528b7 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1148,7 +1148,7 @@ This is because Crowdin requires temporarily flattening this file and removing t Client is currently spoofed to Android VR\n\n Force iOS AVC1 iOS video codec is AVC1 - iOS video codec is AVC1, VP9, or AV1 + iOS video codec is VP9 or AV1 Spoof client thumbnails not available (API timed out) Spoof client thumbnails temporarily not available: %s From 23ad6f441fbd9d486a9b150dfab1ea1a4b4fd115 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 21 Aug 2024 12:49:31 -0400 Subject: [PATCH 4/9] fix: Adjust summary text --- src/main/resources/addresources/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index e2572528b7..b723c66cfd 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1147,7 +1147,7 @@ This is because Crowdin requires temporarily flattening this file and removing t • No HDR video\n• Kids videos do not playback\n• Paused videos can randomly resume\n• Low quality Shorts seekbar thumbnails\n• Download action button is hidden\n• End screen cards are hidden Client is currently spoofed to Android VR\n\n Force iOS AVC1 - iOS video codec is AVC1 + iOS video codec is AVC1 (H.264) iOS video codec is VP9 or AV1 Spoof client thumbnails not available (API timed out) Spoof client thumbnails temporarily not available: %s From fdfdc108d2437d31793241f8b2454a0a115c9a27 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 21 Aug 2024 12:53:13 -0400 Subject: [PATCH 5/9] fix: Use 'AVC' since nerd stats also uses goofy 'AV01' --- .../patches/youtube/misc/fix/playback/SpoofClientPatch.kt | 2 +- src/main/resources/addresources/values/strings.xml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt index 366b1589f7..f9ad8dd766 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt @@ -125,7 +125,7 @@ object SpoofClientPatch : BytecodePatch( entriesKey = "revanced_spoof_client_type_entries", entryValuesKey = "revanced_spoof_client_type_entry_values" ), - SwitchPreference("revanced_spoof_client_ios_force_avc1"), + SwitchPreference("revanced_spoof_client_ios_force_avc"), NonInteractivePreference("revanced_spoof_client_about_android_ios"), NonInteractivePreference("revanced_spoof_client_about_android_vr") ) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index b723c66cfd..0e643ab8a7 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1142,13 +1142,13 @@ This is because Crowdin requires temporarily flattening this file and removing t iOS Android VR iOS spoofing side effects - • HDR video may not be available\n• Watch history does not work with a brand account + • HDR is supported only with AV1 codec\n• Watch history does not work with a brand account Android VR spoofing side effects • No HDR video\n• Kids videos do not playback\n• Paused videos can randomly resume\n• Low quality Shorts seekbar thumbnails\n• Download action button is hidden\n• End screen cards are hidden Client is currently spoofed to Android VR\n\n - Force iOS AVC1 - iOS video codec is AVC1 (H.264) - iOS video codec is VP9 or AV1 + Force iOS AVC + iOS video codec is AVC (H.264) + iOS video codec is VP9 or AV1 Spoof client thumbnails not available (API timed out) Spoof client thumbnails temporarily not available: %s From e0ed2d9b9919592551e9df99ec1da3d2115a49f4 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:19:31 -0400 Subject: [PATCH 6/9] fix: Add user dialog prompt --- src/main/resources/addresources/values/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index 0e643ab8a7..a1ad572b00 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1141,14 +1141,14 @@ This is because Crowdin requires temporarily flattening this file and removing t Spoof client type iOS Android VR + Force iOS AVC + iOS video codec is AVC (H.264) + iOS video codec is AVC, VP9, or AV1 + Enabling this might improve battery life and fix playback stuttering.\n\nWith AVC you might experience higher data usage or decreased video quality. iOS spoofing side effects • HDR is supported only with AV1 codec\n• Watch history does not work with a brand account Android VR spoofing side effects • No HDR video\n• Kids videos do not playback\n• Paused videos can randomly resume\n• Low quality Shorts seekbar thumbnails\n• Download action button is hidden\n• End screen cards are hidden - Client is currently spoofed to Android VR\n\n - Force iOS AVC - iOS video codec is AVC (H.264) - iOS video codec is VP9 or AV1 Spoof client thumbnails not available (API timed out) Spoof client thumbnails temporarily not available: %s From b67c9f3de3c30b5c78fb4ad04d6049242f5e7c61 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 21 Aug 2024 18:46:31 -0400 Subject: [PATCH 7/9] Adjust text --- src/main/resources/addresources/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index a1ad572b00..32dc712951 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1141,8 +1141,8 @@ This is because Crowdin requires temporarily flattening this file and removing t Spoof client type iOS Android VR - Force iOS AVC - iOS video codec is AVC (H.264) + Force iOS AVC (H.264) + iOS video codec is AVC iOS video codec is AVC, VP9, or AV1 Enabling this might improve battery life and fix playback stuttering.\n\nWith AVC you might experience higher data usage or decreased video quality. iOS spoofing side effects From 66e45a3581928d45471a263003c238beb82e0d49 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Thu, 22 Aug 2024 00:17:38 -0400 Subject: [PATCH 8/9] fix: Resolution seems to be capped at 1080p. Quality appears to be the about the same as VP9 but data usage is definitely higher. --- src/main/resources/addresources/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index 32dc712951..bbfabdfabf 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1144,7 +1144,7 @@ This is because Crowdin requires temporarily flattening this file and removing t Force iOS AVC (H.264) iOS video codec is AVC iOS video codec is AVC, VP9, or AV1 - Enabling this might improve battery life and fix playback stuttering.\n\nWith AVC you might experience higher data usage or decreased video quality. + Enabling this might improve battery life and fix playback stuttering.\n\nAVC has a maximum resolution of 1080p, and video playback will use more internet data than VP9 or AV1. iOS spoofing side effects • HDR is supported only with AV1 codec\n• Watch history does not work with a brand account Android VR spoofing side effects From 3fdf46c1036a39e2cf46abfa74b3462547e888f7 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Thu, 22 Aug 2024 00:34:58 -0400 Subject: [PATCH 9/9] fix: Simplify non translatable strings --- src/main/resources/addresources/values/arrays.xml | 5 +++-- src/main/resources/addresources/values/strings.xml | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/resources/addresources/values/arrays.xml b/src/main/resources/addresources/values/arrays.xml index 95c46f9353..f1700555f4 100644 --- a/src/main/resources/addresources/values/arrays.xml +++ b/src/main/resources/addresources/values/arrays.xml @@ -99,8 +99,9 @@ - @string/revanced_spoof_client_type_entry_1 - @string/revanced_spoof_client_type_entry_2 + + iOS + Android VR diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index bbfabdfabf..a696e7a4ba 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1139,8 +1139,6 @@ This is because Crowdin requires temporarily flattening this file and removing t Client is not spoofed\n\nVideo playback may not work Turning off this setting may cause video playback issues. Spoof client type - iOS - Android VR Force iOS AVC (H.264) iOS video codec is AVC iOS video codec is AVC, VP9, or AV1