diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/livechatbutton/patch/HideLiveChatButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/livechatbutton/patch/HideLiveChatButtonPatch.kt
new file mode 100644
index 000000000..a4ca5f257
--- /dev/null
+++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/livechatbutton/patch/HideLiveChatButtonPatch.kt
@@ -0,0 +1,49 @@
+package app.revanced.patches.youtube.layout.player.livechatbutton.patch
+
+import app.revanced.patcher.annotation.Description
+import app.revanced.patcher.annotation.Name
+import app.revanced.patcher.annotation.Version
+import app.revanced.patcher.data.ResourceContext
+import app.revanced.patcher.patch.PatchResult
+import app.revanced.patcher.patch.PatchResultSuccess
+import app.revanced.patcher.patch.ResourcePatch
+import app.revanced.patcher.patch.annotations.DependsOn
+import app.revanced.patcher.patch.annotations.Patch
+import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
+import app.revanced.shared.annotation.YouTubeCompatibility
+import app.revanced.shared.patches.playerbutton.PlayerButtonPatch
+import app.revanced.shared.util.resources.ResourceHelper
+
+@Patch
+@Name("hide-live-chat-button")
+@Description("Hides the live chat button in the video player.")
+@DependsOn(
+ [
+ PlayerButtonPatch::class,
+ SettingsPatch::class
+ ]
+)
+@YouTubeCompatibility
+@Version("0.0.1")
+class HideLiveChatButtonPatch : ResourcePatch {
+ override fun execute(context: ResourceContext): PatchResult {
+
+ /*
+ add settings
+ */
+ ResourceHelper.addSettings2(
+ context,
+ "PREFERENCE_CATEGORY: REVANCED_SETTINGS",
+ "PREFERENCE: LAYOUT_SETTINGS",
+ "PREFERENCE_HEADER: PLAYER",
+ "SETTINGS: HIDE_LIVE_CHAT_BUTTON"
+ )
+
+ ResourceHelper.patchSuccess(
+ context,
+ "hide-live-chat-button"
+ )
+
+ return PatchResultSuccess()
+ }
+}
diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/nextprevbutton/patch/HideNextPrevButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/nextprevbutton/patch/HideNextPrevButtonPatch.kt
new file mode 100644
index 000000000..7da762127
--- /dev/null
+++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/nextprevbutton/patch/HideNextPrevButtonPatch.kt
@@ -0,0 +1,50 @@
+package app.revanced.patches.youtube.layout.player.nextprevbutton.patch
+
+import app.revanced.patcher.annotation.Description
+import app.revanced.patcher.annotation.Name
+import app.revanced.patcher.annotation.Version
+import app.revanced.patcher.data.ResourceContext
+import app.revanced.patcher.patch.PatchResult
+import app.revanced.patcher.patch.PatchResultSuccess
+import app.revanced.patcher.patch.ResourcePatch
+import app.revanced.patcher.patch.annotations.DependsOn
+import app.revanced.patcher.patch.annotations.Patch
+import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
+import app.revanced.shared.annotation.YouTubeCompatibility
+import app.revanced.shared.patches.playerbutton.PlayerButtonPatch
+import app.revanced.shared.util.resources.ResourceHelper
+
+@Patch
+@Name("hide-next-prev-button")
+@Description("Hides the next prev button in the player controller.")
+@DependsOn(
+ [
+ PlayerButtonPatch::class,
+ SettingsPatch::class
+ ]
+)
+@YouTubeCompatibility
+@Version("0.0.1")
+class HideNextPrevButtonPatch : ResourcePatch {
+ override fun execute(context: ResourceContext): PatchResult {
+
+ /*
+ add settings
+ */
+ ResourceHelper.addSettings3(
+ context,
+ "PREFERENCE_CATEGORY: REVANCED_SETTINGS",
+ "PREFERENCE: LAYOUT_SETTINGS",
+ "PREFERENCE_HEADER: PLAYER",
+ "SETTINGS: HIDE_NEXT_BUTTON",
+ "SETTINGS: HIDE_PREV_BUTTON"
+ )
+
+ ResourceHelper.patchSuccess(
+ context,
+ "hide-next-prev-button"
+ )
+
+ return PatchResultSuccess()
+ }
+}
diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt
index 27ec8d951..e35489383 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/misc/resourceid/patch/SharedResourceIdPatch.kt
@@ -32,6 +32,7 @@ class SharedResourcdIdPatch : ResourcePatch {
var layoutCircle: Long = -1
var layoutIcon: Long = -1
var layoutVideo: Long = -1
+ var liveChatButtonId: Long = -1
var scrubbingLabelId: Long = -1
var timebarColorLabelId: Long = -1
var videoqualityfragmentLabelId: Long = -1
@@ -59,6 +60,7 @@ class SharedResourcdIdPatch : ResourcePatch {
layoutCircle = findSharedResourceId("layout", "endscreen_element_layout_circle")
layoutIcon = findSharedResourceId("layout", "endscreen_element_layout_icon")
layoutVideo = findSharedResourceId("layout", "endscreen_element_layout_video")
+ liveChatButtonId = findSharedResourceId("id", "live_chat_overlay_button")
scrubbingLabelId = findSharedResourceId("dimen", "vertical_touch_offset_to_enter_fine_scrubbing")
timebarColorLabelId = findSharedResourceId("color", "inline_time_bar_progress_color")
videoqualityfragmentLabelId = findSharedResourceId("layout", "video_quality_bottom_sheet_list_fragment_title")
diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/LiveChatFingerprint.kt b/src/main/kotlin/app/revanced/shared/fingerprints/LiveChatFingerprint.kt
new file mode 100644
index 000000000..65a7072db
--- /dev/null
+++ b/src/main/kotlin/app/revanced/shared/fingerprints/LiveChatFingerprint.kt
@@ -0,0 +1,16 @@
+package app.revanced.shared.fingerprints
+
+import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
+import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
+import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
+import org.jf.dexlib2.Opcode
+
+object LiveChatFingerprint : MethodFingerprint(
+ opcodes = listOf(Opcode.NEW_INSTANCE),
+ customFingerprint = { methodDef ->
+ methodDef.implementation?.instructions?.any {
+ it.opcode.ordinal == Opcode.CONST.ordinal &&
+ (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.liveChatButtonId
+ } == true
+ }
+)
\ No newline at end of file
diff --git a/src/main/kotlin/app/revanced/shared/patches/playerbutton/PlayerButtonPatch.kt b/src/main/kotlin/app/revanced/shared/patches/playerbutton/PlayerButtonPatch.kt
new file mode 100644
index 000000000..4b98cd165
--- /dev/null
+++ b/src/main/kotlin/app/revanced/shared/patches/playerbutton/PlayerButtonPatch.kt
@@ -0,0 +1,74 @@
+package app.revanced.shared.patches.playerbutton
+
+import app.revanced.patcher.annotation.Name
+import app.revanced.patcher.annotation.Version
+import app.revanced.patcher.data.BytecodeContext
+import app.revanced.patcher.extensions.addInstructions
+import app.revanced.patcher.extensions.instruction
+import app.revanced.patcher.patch.BytecodePatch
+import app.revanced.patcher.patch.PatchResult
+import app.revanced.patcher.patch.PatchResultSuccess
+import app.revanced.patcher.patch.annotations.DependsOn
+import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
+import app.revanced.shared.annotation.YouTubeCompatibility
+import app.revanced.shared.extensions.findMutableMethodOf
+import app.revanced.shared.extensions.toErrorResult
+import app.revanced.shared.fingerprints.LiveChatFingerprint
+import app.revanced.shared.util.integrations.Constants.PLAYER_LAYOUT
+import org.jf.dexlib2.Opcode
+import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
+import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
+
+@Name("hook-player-button-patch")
+@DependsOn([SharedResourcdIdPatch::class])
+@YouTubeCompatibility
+@Version("0.0.1")
+class PlayerButtonPatch : BytecodePatch(
+ listOf(
+ LiveChatFingerprint
+ )
+) {
+ override fun execute(context: BytecodeContext): PatchResult {
+
+ LiveChatFingerprint.result?.let {
+ val endIndex = it.scanResult.patternScanResult!!.endIndex
+ val instuctions = it.mutableMethod.instruction(endIndex)
+ val imageButtonClass =
+ context
+ .findClass((instuctions as BuilderInstruction21c)
+ .reference.toString())!!
+ .mutableClass
+
+ for (method in imageButtonClass.methods) {
+ with (imageButtonClass.findMutableMethodOf(method)) {
+ var jumpInstruction = true
+
+ implementation!!.instructions.forEachIndexed { index, instuctions ->
+ if (instuctions.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal) {
+ val definedInstruction = (instuctions as? BuilderInstruction35c)
+
+ if (definedInstruction?.reference.toString() ==
+ "Landroid/view/View;->setVisibility(I)V") {
+
+ jumpInstruction = !jumpInstruction
+ if (jumpInstruction) return@forEachIndexed
+
+ val firstRegister = definedInstruction?.registerC
+ val secondRegister = definedInstruction?.registerD
+
+ addInstructions(
+ index, """
+ invoke-static {v$firstRegister, v$secondRegister}, $PLAYER_LAYOUT->hidePlayerButton(Landroid/view/View;I)I
+ move-result v$secondRegister
+ """
+ )
+ }
+ }
+ }
+ }
+ }
+ } ?: return LiveChatFingerprint.toErrorResult()
+
+ return PatchResultSuccess()
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml
index a6bae2fc4..da2515ef2 100644
--- a/src/main/resources/youtube/settings/host/values/strings.xml
+++ b/src/main/resources/youtube/settings/host/values/strings.xml
@@ -339,6 +339,9 @@ Is it ready to submit?"
Info cards are shown
Info cards are hidden
Hide info cards
+ Live chat button is shown
+ Live chat button is hidden
+ Hide live chat button
Ambient mode menu is shown
Ambient mode menu is hidden
Hide ambient mode menu
@@ -375,9 +378,15 @@ Is it ready to submit?"
Mix playlist is shown
Mix playlist is hidden
Hide mix playlist
+ Next button is shown
+ Next button is hidden
+ Hide next button
Player overlay filter is shown
Player overlay filter is hidden
Hide player overlay filter
+ Prev button is shown
+ Prev button is hidden
+ Hide prev button
Preview comment is shown
Preview comment is hidden
Hide preview comment
diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
index 684a9d42c..6af44d014 100644
--- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml
+++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
@@ -157,6 +157,15 @@
+
+
+
+
+
+
@@ -374,6 +383,8 @@
+
+