Skip to content

Commit 6bb848b

Browse files
author
LisoUseInAIKyrios
authored
feat(YouTube - Spoof client): Allow forcing AVC codec with iOS (#3570)
1 parent 188b66f commit 6bb848b

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofClientPatch.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import app.revanced.patcher.patch.annotation.Patch
1414
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
1515
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
1616
import app.revanced.patches.all.misc.resources.AddResourcesPatch
17+
import app.revanced.patches.shared.misc.settings.preference.ListPreference
18+
import app.revanced.patches.shared.misc.settings.preference.NonInteractivePreference
1719
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
1820
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
1921
import app.revanced.patches.youtube.misc.backgroundplayback.BackgroundPlaybackPatch
@@ -118,9 +120,16 @@ object SpoofClientPatch : BytecodePatch(
118120
sorting = PreferenceScreen.Sorting.UNSORTED,
119121
preferences = setOf(
120122
SwitchPreference("revanced_spoof_client"),
121-
SwitchPreference("revanced_spoof_client_use_ios"),
122-
),
123-
),
123+
ListPreference("revanced_spoof_client_type",
124+
summaryKey = null,
125+
entriesKey = "revanced_spoof_client_type_entries",
126+
entryValuesKey = "revanced_spoof_client_type_entry_values"
127+
),
128+
SwitchPreference("revanced_spoof_client_ios_force_avc"),
129+
NonInteractivePreference("revanced_spoof_client_about_android_ios"),
130+
NonInteractivePreference("revanced_spoof_client_about_android_vr")
131+
)
132+
)
124133
)
125134

126135
// region Block /initplayback requests to fall back to /get_watch requests.

src/main/resources/addresources/values/arrays.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@
9797
<item>END</item>
9898
</string-array>
9999
</patch>
100+
<patch id="misc.fix.playback.SpoofClientPatch">
101+
<string-array name="revanced_spoof_client_type_entries">
102+
<!-- OS names are the same in all languages, so specify them here and not in Strings.xml -->
103+
<item>iOS</item>
104+
<item>Android VR</item>
105+
</string-array>
106+
<string-array name="revanced_spoof_client_type_entry_values">
107+
<!-- Enum names from Integrations -->
108+
<item>IOS</item>
109+
<item>ANDROID_VR</item>
110+
</string-array>
111+
</patch>
100112
<patch id="video.quality.RememberVideoQualityPatch">
101113
<string-array name="revanced_video_quality_default_entries">
102114
<item>@string/revanced_video_quality_default_entry_1</item>

src/main/resources/addresources/values/strings.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,9 +1138,15 @@ This is because Crowdin requires temporarily flattening this file and removing t
11381138
<string name="revanced_spoof_client_summary_on">Client is spoofed</string>
11391139
<string name="revanced_spoof_client_summary_off">Client is not spoofed\n\nVideo playback may not work</string>
11401140
<string name="revanced_spoof_client_user_dialog_message">Turning off this setting may cause video playback issues.</string>
1141-
<string name="revanced_spoof_client_use_ios_title">Spoof client to iOS</string>
1142-
<string name="revanced_spoof_client_use_ios_summary_on">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</string>
1143-
<string name="revanced_spoof_client_use_ios_summary_off">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</string>
1141+
<string name="revanced_spoof_client_type_title">Spoof client type</string>
1142+
<string name="revanced_spoof_client_ios_force_avc_title">Force iOS AVC (H.264)</string>
1143+
<string name="revanced_spoof_client_ios_force_avc_summary_on">iOS video codec is AVC</string>
1144+
<string name="revanced_spoof_client_ios_force_avc_summary_off">iOS video codec is AVC, VP9, or AV1</string>
1145+
<string name="revanced_spoof_client_ios_force_avc_user_dialog_message">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.</string>
1146+
<string name="revanced_spoof_client_about_android_ios_title">iOS spoofing side effects</string>
1147+
<string name="revanced_spoof_client_about_android_ios_summary">• HDR is supported only with AV1 codec\n• Watch history does not work with a brand account</string>
1148+
<string name="revanced_spoof_client_about_android_vr_title">Android VR spoofing side effects</string>
1149+
<string name="revanced_spoof_client_about_android_vr_summary">• 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</string>
11441150
<string name="revanced_spoof_client_storyboard_timeout">Spoof client thumbnails not available (API timed out)</string>
11451151
<string name="revanced_spoof_client_storyboard_io_exception">Spoof client thumbnails temporarily not available: %s</string>
11461152
</patch>

0 commit comments

Comments
 (0)