diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt index 4ec359ee3a..311c958f2d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt @@ -58,7 +58,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( VideoIdPatch.hookVideoId("$INTEGRATIONS_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V") // Hook the player response video id, to start loading RYD sooner in the background. - VideoIdPatch.hookPlayerResponseVideoId("$INTEGRATIONS_CLASS_DESCRIPTOR->preloadVideoId(Ljava/lang/String;)V") + VideoIdPatch.hookPlayerResponseVideoId("$INTEGRATIONS_CLASS_DESCRIPTOR->preloadVideoId(Ljava/lang/String;Z)V") // endregion @@ -184,7 +184,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch( LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR) // Player response video id is needed to search for the video ids in Shorts litho components. - VideoIdPatch.hookPlayerResponseVideoId("$FILTER_CLASS_DESCRIPTOR->newPlayerResponseVideoId(Ljava/lang/String;)V") + VideoIdPatch.hookPlayerResponseVideoId("$FILTER_CLASS_DESCRIPTOR->newPlayerResponseVideoId(Ljava/lang/String;Z)V") // endregion diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt index 4d5ac37985..becfb4dfdf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt @@ -114,7 +114,7 @@ object VideoInformationPatch : BytecodePatch( VideoIdPatch.hookVideoId(videoIdMethodDescriptor) VideoIdPatch.hookBackgroundPlayVideoId(videoIdMethodDescriptor) VideoIdPatch.hookPlayerResponseVideoId( - "$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;)V") + "$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;Z)V") /* * Set the video time method diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt index a08531bb1c..d1e43c6718 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt @@ -19,6 +19,7 @@ object PlayerResponseMethodHookPatch : Closeable, MutableSet by mutableSetOf() { private const val VIDEO_ID_PARAMETER = 1 + private const val VIDEO_IS_OPENING_OR_PLAYING_PARAMETER = 11 private const val PROTO_BUFFER_PARAMETER_PARAMETER = 3 private lateinit var playerResponseMethod: MutableMethod @@ -30,7 +31,7 @@ object PlayerResponseMethodHookPatch : override fun close() { fun hookVideoId(hook: Hook) = playerResponseMethod.addInstruction( - 0, "invoke-static {p$VIDEO_ID_PARAMETER}, $hook" + 0, "invoke-static {p$VIDEO_ID_PARAMETER, p$VIDEO_IS_OPENING_OR_PLAYING_PARAMETER}, $hook" ) fun hookProtoBufferParameter(hook: Hook) = playerResponseMethod.addInstructions( diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/fingerprint/PlayerParameterBuilderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/fingerprint/PlayerParameterBuilderFingerprint.kt index 9e577e0b9a..1004e8bb54 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/fingerprint/PlayerParameterBuilderFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/fingerprint/PlayerParameterBuilderFingerprint.kt @@ -18,7 +18,7 @@ object PlayerParameterBuilderFingerprint : MethodFingerprint( "Ljava/lang/String;", "Ljava/lang/String;", "L", - "Z", + "Z", // Appears to indicate if the video id is being opened or is currently playing. "Z", "Z" ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt index 6149f33e68..30a1646b15 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt @@ -103,6 +103,9 @@ object VideoIdPatch : BytecodePatch( * Hooks the video id of every video when loaded. * Supports all videos and functions in all situations. * + * First parameter is the video id. + * Second parameter is if the video is being opened or is currently playing. + * * Hook is always called off the main thread. * * This hook is called as soon as the player response is parsed, @@ -117,7 +120,7 @@ object VideoIdPatch : BytecodePatch( * * Be aware, this can be called multiple times for the same video id. * - * @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;` + * @param methodDescriptor which method to call. Params must be `Ljava/lang/String;Z` */ fun hookPlayerResponseVideoId(methodDescriptor: String) { PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.VideoId(