ReVanced / revanced-patches

🧩 Patches for ReVanced
https://revanced.app
GNU General Public License v3.0
2.32k stars 269 forks source link

bug(YouTube): Video is temporarily frozen while audio plays #184

Closed julausrie closed 11 months ago

julausrie commented 11 months ago

Bug description

I have an problem since an week on YouTube Revanced that videos will freeze the entire application for about 20 seconds while the audio of the video continues playing. I tried turning off "spoof app signature", which actually fixes that issue but the video randomly stops playing after a while, so turning it off is not an good option.

Error logs

No response

Solution

Fix spoof app signature

Additional context

No response

Acknowledgements

oSumAtrIX commented 11 months ago

Did you patch the app with the latest patches?

LisoUseInAIKyrios commented 11 months ago

The storyboard fetch had an issue with temporarily freezing the video while the audio played, but it only showed up a few seconds maximum and not 20 seconds, and the issue was only on an old dev release and was fixed before main release.

@julausrie post a video showing the issue.

julausrie commented 11 months ago

@LisoUseInAIKyrios https://youtube.com/shorts/Pob99OZaRxQ?feature=share

julausrie commented 11 months ago

Did you patch the app with the latest patches?

Yes I patched the app yesterday again to make sure, but that didnt fixed it

LisoUseInAIKyrios commented 11 months ago

I don't hear any audio playing, and it looks like playback completely fails.

Try one or more of the following:

julausrie commented 11 months ago

@LisoUseInAIKyrios No, the audio keeps playing, you just need to turn your volume up because the video is a bit quiet. And after the lag it jumps to the part of the video where the audio is playing, so the video keeps playing while it freezes.

LisoUseInAIKyrios commented 11 months ago

Does it do this on every video? Try repatching with just microg and client-spoof, and see if the issue still exists.

julausrie commented 11 months ago

@LisoUseInAIKyrios I tried it with these patches you said, but that didnt fixed it, it still freezes for some seconds while the audio keeps playing.

LisoUseInAIKyrios commented 11 months ago

Try using a different YouTube account, or try turning on incognito mode.

Also try turning on version spoofing (under ReVanced -> Layout), and try 17.x and 16.x spoof targets.

julausrie commented 11 months ago

@LisoUseInAIKyrios That actually fixed it. 18.x works too. Thanks!

LisoUseInAIKyrios commented 11 months ago

Did you try incognito mode or a different YouTube account without using version spoofing?

julausrie commented 11 months ago

@LisoUseInAIKyrios It didnt changed if I had incognito mode on or with an different YouTube account without version spoofing

julausrie commented 11 months ago

@LisoUseInAIKyrios I just noticed that it didn't fixed it sadly, it Still happens. Just it appears only a bit less often. Guess I was only lucky that it didn't freeze while testing

oSumAtrIX commented 11 months ago

Enable logging under Misc > Debugging and check if logcat prints anything if you grep for "Spoof"

julausrie commented 11 months ago

@LisoUseInAIKyrios where are the logs saved

LisoUseInAIKyrios commented 11 months ago

You'll need to use a computer and the command line tools adb.

Steps to get adb working: https://sodawithoutsparkles.github.io/revanced-troubleshooting-guide/04-adb-install/#steps

And steps to collect the debug logs: https://github.com/ReVanced/revanced-integrations#-how-to-use-debugging

If you accomplish all of this, then post the debug logs here or upload the logs to some text sharing site.

One last step to try before that, is clear the ReVanced YT app data and see if that helps.

GKid94 commented 11 months ago

Same problem, videos just get stuck and keep buffering Screenshot_2023-10-23-04-27-17-045_com android settings Screenshot_2023-10-23-04-27-10-986_com miui securitycenter

julausrie commented 11 months ago

@LisoUseInAIKyrios I tried doing that but it says: 127|beyond2q:/storage $ adb logcat | findstr "revanced" > log.txt /system/bin/sh: adb: inaccessible or not found /system/bin/sh: can't create log.txt: Permission denied Its pretty complicated so i dont know what to do

LisoUseInAIKyrios commented 11 months ago

adb: inaccessible or not found You probably are in the wrong directory.

Make sure you can run adb devices and it shows your device. It will look something like: https://beebom.com/wp-content/uploads/2020/02/Annotation-2020-02-15-130144.jpg

julausrie commented 11 months ago

@LisoUseInAIKyrios Okay i was successfull this time. Heres the log: log.txt

LisoUseInAIKyrios commented 11 months ago

There's no debug log entries.

Make sure debugging is enabled in ReVanced -> Misc (turn on debugging. Do not turn on stack trace or protobuffer).

Then use the app, get it to freeze and act up, then collect the logs with adb.

julausrie commented 11 months ago

Hmm i had debug enabled since yesterday.. The bug is also very strange. I just cant get any video to freeze again, even Videos that froze yesterday dont freeze anymore.

LisoUseInAIKyrios commented 11 months ago

I would say it might be a bug in YouTube, but you said that turning off signature spoofing fixed the issue.

If the issue comes back, then you can try patching using ReVanced CLI and use the prior release that does not fix the seekbar thumbnails. That is the only thing I can think of that might be causing the video temporarily freezing (even though I don't think it's the issue).

You'll need to use the Sept 3rd releases: https://github.com/ReVanced/revanced-patches/releases/tag/v2.190.0 https://github.com/ReVanced/revanced-integrations/releases/tag/v0.117.1 https://github.com/ReVanced/revanced-cli/releases/tag/v3.1.0

You'll also need to uninstall your existing YT ReVanced, then use CLI to patch YouTube 18.32.39 and install that (cannot install on top of existing since it's a version downgrade).

But otherwise there's no much else than can be done for now.

oSumAtrIX commented 11 months ago

turning off signature spoofing fixed the issue

This is unlikely. A/B usually takes some time to turn on. Also, the spoof client patch spoofs the player request to that of someone who is not logged in, so the account should play no role.

We would need logging to determine if the hook is being called, perhaps it may not be due to some A/B changes.

LisoUseInAIKyrios commented 11 months ago

I was able to reproduce this issue, where after opening a video the picture was frozen about 3-4 seconds while audio played. The problem started immediately after turning on "enable tablet layout". After turning the feature off the issue still occured about once ever 10th video opened.

Clearing the app data fixed the problem.

For reference, it was not RYD fetching as all fetches were under 500ms which is way shorter than the video was frozen, and RYD has never had an issue with interfering with regular video playback. RYD can delay showing the UI below the video until after the API fetch completed, but the video will still play correctly while the fetch is occuring.

To anyone who has this issue, ensure you are not using "enable tablet layout" and also clear the YouTube app data.

oSumAtrIX commented 11 months ago

It is may be possible that a combo of patches causes the issue. For example tablet layout could cause RYD to fail

LisoUseInAIKyrios commented 11 months ago

For me RYD was not failing and worked correctly. RYD debug stats showed no failed fetches, max fetch time of 500ms, and average fetch of 125ms.

I think turning on tablet mode put the app into a half broken state, where the data/cache/whatever was for a phone but now it's behaving like a tablet. Similar to the broken UI when spoofing to 17.30.35 where it has new and old data that act up and the player UI litho buttons are the wrong size/shape.

oSumAtrIX commented 11 months ago

Can you try simulating slow connection in RYD and see if the behavior is similar?

LisoUseInAIKyrios commented 11 months ago

Yes there is code to artificially add a random delay up to 7 seconds long: https://github.com/ReVanced/revanced-integrations/blob/650a5e06ee5bcceee9455230a6f6aa6444311cc2/app/src/main/java/app/revanced/integrations/returnyoutubedislike/requests/ReturnYouTubeDislikeApi.java#L145 anyone can try enabling it.

The UI will timeout after waiting 4.5 seconds, so any UI blocking issues will show up when this debug flag is enabled

Regular videos always play correctly when this is enabled, except for the UI below the video will not appear until after the fetch completes (but the video will play correctly while the fetch is running).

Shorts playback can be temporary frozen with audio playing while the fetch completes, and this is a known limitation of the current approach. It only affects the first short opened, and usually only the first short opened after cold app start. The next shorts the user can swipe to is not affected because RYD is prefetched in the background. But the freezing issue here isn't for Shorts and is for regular videos.

th1nhhdk commented 11 months ago

I have the same problem, freezes for about 11 seconds before returning to normal

LisoUseInAIKyrios commented 11 months ago

@th1nhhdk try some of the other steps including:

And lastly, try uninstalling ReVanced YouTube and try patching version 18.37.36 (an older but still supported version)

th1nhhdk commented 11 months ago

@th1nhhdk try some of the other steps including:

  • turn on YouTube incognito mode
  • use a different YouTube account
  • turn on version spoofing (ReVanced -> Layout) and use 18.20.39 or older

And lastly, try uninstalling ReVanced YouTube and try patching version 18.37.36 (an older but still supported version)

i'll try 18.37.36

th1nhhdk commented 11 months ago

And lastly, try uninstalling ReVanced YouTube and try patching version 18.37.36 (an older but still supported version)

Oh god, it have the same problem, freezes for about 20 second

LisoUseInAIKyrios commented 11 months ago

@th1nhhdk if you have a computer, then patch using the previous ReVanced major release described here

th1nhhdk commented 11 months ago

@th1nhhdk if you have a computer, then patch using the previous ReVanced major release described here

is there a step by step instruction? i'm kinda new to patching things

LisoUseInAIKyrios commented 11 months ago

https://sodawithoutsparkles.github.io/revanced-troubleshooting-guide/06-revanced-cli/

th1nhhdk commented 11 months ago

I would say it might be a bug in YouTube, but you said that turning off signature spoofing fixed the issue.

If the issue comes back, then you can try patching using ReVanced CLI and use the prior release that does not fix the seekbar thumbnails. That is the only thing I can think of that might be causing the video temporarily freezing (even though I don't think it's the issue).

You'll need to use the Sept 3rd releases: https://github.com/ReVanced/revanced-patches/releases/tag/v2.190.0 https://github.com/ReVanced/revanced-integrations/releases/tag/v0.117.1 https://github.com/ReVanced/revanced-cli/releases/tag/v3.1.0

You'll also need to uninstall your existing YT ReVanced, then use CLI to patch YouTube 18.32.39 and install that (cannot install on top of existing since it's a version downgrade).

But otherwise there's no much else than can be done for now.

It works!, thanks.

LisoUseInAIKyrios commented 11 months ago

Do one last step, and try patching 18.32.39 using the latest patches. Some patches won't be applied, but it will determine if the issue is from a patch change or if it's newer versions of YouTube.

You can do download latest releases and use CLI again, or you can use Manager and patch 18.32.39 (uninstall existing ReVanced YouTube first)

julausrie commented 11 months ago

@th1nhhdk I havent had the issue for days now. It happened once but then never again. @LisoUseInAIKyrios Is this maybe related to an YouTube issue than Revanced, or not?

th1nhhdk commented 11 months ago

Do one last step, and try patching 18.20.39 using the latest patches. Do one last step, and try patching 18.32.39 using the latest patches.

The problem happens with both versions

LisoUseInAIKyrios commented 11 months ago

Try again, and patch 18.32.39 with the latest patches but only include client-spoof and microg (and uninstall existing ReVanced YT before patching).

And if it still doesn't work then try turning off signature spoofing and see if that fixes it.