Skip to content

Commit

Permalink
feat(YouTube - Spoof client): Allow forcing AVC codec with iOS (ReVan…
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios authored Aug 22, 2024
1 parent 1872d81 commit 1a49d1f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -118,9 +120,16 @@ object SpoofClientPatch : BytecodePatch(
sorting = PreferenceScreen.Sorting.UNSORTED,
preferences = setOf(
SwitchPreference("revanced_spoof_client"),
SwitchPreference("revanced_spoof_client_use_ios"),
),
),
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_avc"),
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.
Expand Down
12 changes: 12 additions & 0 deletions src/main/resources/addresources/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@
<item>END</item>
</string-array>
</patch>
<patch id="misc.fix.playback.SpoofClientPatch">
<string-array name="revanced_spoof_client_type_entries">
<!-- OS names are the same in all languages, so specify them here and not in Strings.xml -->
<item>iOS</item>
<item>Android VR</item>
</string-array>
<string-array name="revanced_spoof_client_type_entry_values">
<!-- Enum names from Integrations -->
<item>IOS</item>
<item>ANDROID_VR</item>
</string-array>
</patch>
<patch id="video.quality.RememberVideoQualityPatch">
<string-array name="revanced_video_quality_default_entries">
<item>@string/revanced_video_quality_default_entry_1</item>
Expand Down
12 changes: 9 additions & 3 deletions src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1138,9 +1138,15 @@ This is because Crowdin requires temporarily flattening this file and removing t
<string name="revanced_spoof_client_summary_on">Client is spoofed</string>
<string name="revanced_spoof_client_summary_off">Client is not spoofed\n\nVideo playback may not work</string>
<string name="revanced_spoof_client_user_dialog_message">Turning off this setting may cause video playback issues.</string>
<string name="revanced_spoof_client_use_ios_title">Spoof client to iOS</string>
<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>
<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>
<string name="revanced_spoof_client_type_title">Spoof client type</string>
<string name="revanced_spoof_client_ios_force_avc_title">Force iOS AVC (H.264)</string>
<string name="revanced_spoof_client_ios_force_avc_summary_on">iOS video codec is AVC</string>
<string name="revanced_spoof_client_ios_force_avc_summary_off">iOS video codec is AVC, VP9, or AV1</string>
<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>
<string name="revanced_spoof_client_about_android_ios_title">iOS spoofing side effects</string>
<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>
<string name="revanced_spoof_client_about_android_vr_title">Android VR spoofing side effects</string>
<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>
<string name="revanced_spoof_client_storyboard_timeout">Spoof client thumbnails not available (API timed out)</string>
<string name="revanced_spoof_client_storyboard_io_exception">Spoof client thumbnails temporarily not available: %s</string>
</patch>
Expand Down

0 comments on commit 1a49d1f

Please sign in to comment.