ReVanced / revanced-patches

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

bug: YouTube music revanced stops playback after playing one song if screen is off #1197

Closed briantho closed 1 year ago

briantho commented 1 year ago

Type

Error while patching

Bug description

This bug happens when you try and search for music from youtube music revanced. it does not happen if you use quick picks, nor when selecting a song from the main screen. it only happens when you search, select a song, play it, and while playing turn off the screen. It works completely fine while the screen is on. I'm using revanced manager 0.0.57 rooted, and youtube music 5.39.52

I have the following patches selected.

Background Play codecs unlock hide get premium music video ads tastebuilder remover upgrade button remover

Steps to reproduce

  1. Open youtube music revanced
  2. search for a song (can be any song) (eg "September earth wing & fire")
  3. play the song
  4. turn off the screen
  5. wait for the next song to be played, but it does not play. It simply stops after the current song.

Relevant log output

--------- beginning of crash
05-04 23:57:40.843   602   602 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 602 (init), pid 602 (init)
05-04 23:57:40.855   602   602 F libc    : crash_dump helper failed to exec
04-02 20:11:58.677  3558  3558 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 3558 (init), pid 3558 (init)
04-02 20:11:58.704  3558  3558 F libc    : crash_dump helper failed to exec
04-02 20:14:17.853 17753 17753 E AndroidRuntime: FATAL EXCEPTION: main
04-02 20:14:17.853 17753 17753 E AndroidRuntime: Process: com.qti.diagservices, PID: 17753
04-02 20:14:17.853 17753 17753 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.qti.diagservices.Diag_OnBoot: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.qti.diagservices/.QTIDiagServices }: app is in background uid UidRecord{db1e2da u2357s1000 SVC  bg:+1m35s307ms idle change:idle procs:3 seq(0,0,0)}
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.app.ActivityThread.handleReceiver(ActivityThread.java:4103)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.app.ActivityThread.access$1400(ActivityThread.java:240)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1979)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:248)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7787)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
04-02 20:14:17.853 17753 17753 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.qti.diagservices/.QTIDiagServices }: app is in background uid UidRecord{db1e2da u2357s1000 SVC  bg:+1m35s307ms idle change:idle procs:3 seq(0,0,0)}
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1715)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.app.ContextImpl.startService(ContextImpl.java:1670)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.content.ContextWrapper.startService(ContextWrapper.java:727)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.content.ContextWrapper.startService(ContextWrapper.java:727)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at com.qti.diagservices.Diag_OnBoot.onReceive(Diag_OnBoot.java:40)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    at android.app.ActivityThread.handleReceiver(ActivityThread.java:4092)
04-02 20:14:17.853 17753 17753 E AndroidRuntime:    ... 8 more
--------- beginning of system

Screenshots or videos

No response

Solution

No response

Additional context

tested using revanced manager 0.0.57 rooted, and youtube music 5.39.52 on a Asus Zenfone 6

Acknowledgements

briantho commented 1 year ago

Whoops, this is NOT a error while patching but an error while using

oSumAtrIX commented 1 year ago

Unable to reproduce, leaving open for others to reproduce.

briantho commented 1 year ago

Unable to reproduce, leaving open for others to reproduce.

did you search for a song? or select one from quick picks, or listen again? it only happens when searching for a song. quick picks, listen again, and everything from the home screen of youtube music work complexly fine. you also need to have the screen off and wait till the song finishes. it will not load the next song in the autoplay queue

oSumAtrIX commented 1 year ago

Yes, that is exactly what I tried and it works as expected

briantho commented 1 year ago

Yes, that is exactly what I tried and it works as expected

hmm, ok. interesting. I just tried another phone (google pixel 5a) with youtube music revanced using the same patcher settings. same result. Would you mind sharing what version of youtube music you are using, as well as what patchers you have applied?

oSumAtrIX commented 1 year ago

I tried on version 5.50.53

briantho commented 1 year ago

Just tried updating. Same issue for me, anyway. I uninstalled the version I had, and Installed the latest version of YouTube music from the play store as suggested. I then patched it with the same settings as before with revanced manager, and installed it as root. Then I launched, searched for a song, pressed play, turned off the screen, waited for the song to end, and nothing. No next song. This happens for me only with the screen off. With the screen on the next song in the autoplaylist continues. For me it's odd that you can't reproduce this, and I've been able to reproduce every time on 3 different android devices now. I'll attach a screenshot below showing the state after the first song plays with the screen off, and tomorrow I'll try getting a full logcat done. Screenshot_20230403-221852224 Screenshot_20230403-221908395

briantho commented 1 year ago

Here are my logcats. Please let me know if they are of any value or can help determine the issue. screen_off (stops after current song).txt screen_on (working properly).txt

oSumAtrIX commented 1 year ago

Please attach a complete recording of the patching process. Start by closing and reopening ReVanced Manager and finish the recording after opening the application.

briantho commented 1 year ago

full_patching_process.txt ok, here is the full patching process start to finish. i also, uninstalled and reinstalled youtube music fresh from the play store. I made sure to close revanced manager, and reopen once i had logcat running. Please let me know if there is anything else you need, or want me to try

oSumAtrIX commented 1 year ago

Please attach a complete recording of the patching process

I need a recording, not a log.

briantho commented 1 year ago

ah ok, video recording. got it. I misunderstood. here you go.

https://user-images.githubusercontent.com/3977205/230208783-e83d7e7c-dfcb-4fa0-a6a8-20723e650a8c.mp4

oSumAtrIX commented 1 year ago

Looks good to me. Unfortunately, I can not reproduce this issue. I saw some exceptions in the logs but I don't know how they are related to your issue yet.

briantho commented 1 year ago

hi, I also found out that this bug applies when youtube music is running in the background. This happens even though I have selected "Background Play" under revanced manager, and patched accordingly. I will include videos showing the problem. Notice that when i have youtube music running in the background the song continues playing, but after the song finishes the next song does not load.

here is a video showing youtube music running in the background. Notice it stops after the current song is played

https://user-images.githubusercontent.com/3977205/230474047-216b4ba7-f70f-4a46-9d05-8ab8dd649a98.mp4

and here is a video showing youtube music running in the foreground. Notice it continues to the next song.

https://user-images.githubusercontent.com/3977205/230474447-1994dfb7-54ab-4d76-9ca2-47bf1d452ec6.mp4

Also, note that i played the played the song in the middle so that it cuts down on the recording time. It does not make a difference if you play the song start to finish, or in the middle

LisoUseInAIKyrios commented 1 year ago

Have you tried turning off battery optimization for YouTube Music?

briantho commented 1 year ago

Just tried turning off battery optimization, and relaunched YouTube music. Same results. I'm pretty sure this is a bug with the "background play" patch of YouTube music. Also this bug does not happen if I select music from the home screen of YouTube music, such as "quick picks" or "listen again". It only happens when you search for a specific song using search.

oSumAtrIX commented 1 year ago

So far you are the only one to experience this, it works for me and anyone else I asked, unless we can reproduce we can't help you

oSumAtrIX commented 1 year ago

https://user-images.githubusercontent.com/13122796/230635447-48916d03-4473-402b-96aa-f97d89a68fc0.mp4

briantho commented 1 year ago

FINALLY FINALLY Figured it out. Not sure if everything I did to fix it was necessary, but it's working now on both my rooted phone, and a non rooted phone. Here's what i did.

uninstalled youtube music. (both revanced and regular for non-root) under revanced manager, i deleted the keystore, temporary files, logs and reset all patches. I then installed the official version of youtube music from the play store. On my rooted phone, i selected all of my previous patches and patched as root. Tried launching youtube music again, and did the same test. This time it worked!

Thanks for your help! Glad to have it finally working correctly!