add Disable default video speed in live stream settings https://github.com/inotia00/ReVanced_Extended/issues/626

This commit is contained in:
inotia00
2023-04-11 05:59:28 +09:00
parent 0c50deb95a
commit 2680cfe849
5 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,8 @@
package app.revanced.patches.youtube.video.livestream.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object OrganicPlaybackContextModelFingerprint : MethodFingerprint(
returnType = "V",
strings = listOf("Null contentCpn")
)

View File

@ -0,0 +1,38 @@
package app.revanced.patches.youtube.video.livestream.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.video.livestream.fingerprints.OrganicPlaybackContextModelFingerprint
import app.revanced.util.integrations.Constants.VIDEO_PATH
@Name("live-stream-speed")
@YouTubeCompatibility
@Version("0.0.1")
class LiveStreamPatch : BytecodePatch(
listOf(
OrganicPlaybackContextModelFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
OrganicPlaybackContextModelFingerprint.result?.mutableMethod?.addInstruction(
2,
"invoke-static { p2 }, $INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR->liveStreamObserver(Z)V"
) ?: return OrganicPlaybackContextModelFingerprint.toErrorResult()
return PatchResultSuccess()
}
private companion object {
const val INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR =
"$VIDEO_PATH/VideoSpeedPatch;"
}
}

View File

@ -14,6 +14,7 @@ import app.revanced.patches.youtube.misc.overridespeed.bytecode.fingerprints.Vid
import app.revanced.patches.youtube.misc.overridespeed.bytecode.patch.OverrideSpeedHookPatch
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.misc.videoid.legacy.patch.LegacyVideoIdPatch
import app.revanced.patches.youtube.video.livestream.patch.LiveStreamPatch
import app.revanced.patches.youtube.video.speed.bytecode.fingerprints.*
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
import app.revanced.util.integrations.Constants.VIDEO_PATH
@ -23,6 +24,7 @@ import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
@DependsOn(
[
LegacyVideoIdPatch::class,
LiveStreamPatch::class,
OverrideSpeedHookPatch::class,
SharedResourceIdPatch::class
]
@ -64,6 +66,5 @@ class VideoSpeedBytecodePatch : BytecodePatch(
private companion object {
const val INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR =
"$VIDEO_PATH/VideoSpeedPatch;"
var insertIndex: Int = 0
}
}