Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(YouTube - Video Id): Fix video id not showing the currently playing video #3038

Merged
merged 8 commits into from
Sep 28, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.video.information.VideoInformationPatch
import app.revanced.patches.youtube.video.playerresponse.fingerprint.PlayerParameterBuilderFingerprint

@Patch(
Expand All @@ -32,10 +33,16 @@ object PlayerResponseMethodHookPatch : BytecodePatch(

fun hookVideoId(methodDescriptor: String) {
playerResponseMethod.addInstruction(
++videoIdHookInsertIndex, "invoke-static {p$VIDEO_ID_PARAMETER}, $methodDescriptor"
videoIdHookInsertIndex++, "invoke-static {p$VIDEO_ID_PARAMETER}, $methodDescriptor"
)

// TODO: Explain why any video id hook has to precede any protoBufferParameterHook.
/**
* Adjust the buffer hook insert index since this video id hook was added before it.
*
* This ensures all video id hooks always run before the buffer hooks,
* so if the buffer hook calls into [VideoInformationPatch]
LisoUseInAIKyrios marked this conversation as resolved.
Show resolved Hide resolved
* it has the correct and updated player response video id.
*/
protoBufferParameterHookInsertIndex++
}

Expand Down