-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Unexpected pauses when switching player type #5016
Comments
It's certainly not connected to my internet speeds, all the other youtube apps never have this issue |
All the battery-saving power management options are disabled on my phone |
This is expected because the player type is changed. The player is destroyed and recreated again. You should have noticed it too when you minimized it. It's just longer during entering because the details screen takes more time to create than the background player for example. So it's basically no bug but designed like that. |
Is it a good design element? Would it be difficult to make the playback persistent like in other youtube apps? |
Hmm, I checked it. I though if you leave the app while the details are visible the player changes to the background player but it isn't. So you're right, there is basically no necessary to reload it. @Stypox Is it always needed to re-assign the PlaybackManager in this specific case when the play queue entries are equal? |
@vkay94 the pause is just a process that reload the stream with video enabled or disabled based on current situation (the app in background - video disabled, in foreground - video enabled). So |
This behaviour doesn't happen on Vanced. |
Is there any update to this? I am still having this issue a lot. |
@Oizaro probably vanced just keeps playing the video in the background, instead of switching to audio. I don't know if there is any way to improve this. |
What are the draw backs of this? If the video keeps playing without pauses isn't that good? Idk how switching to a different player works but, would there be a way to implement something like using the same video player for the rest of the playing video and then switching to another video player when the video is done? That way the pause for the switch is hidden a little better and less obnoxious. |
@Coderdude112 the drawbacks are increased battery consumption and data usage, since the video would still be loaded alongside audio |
Honestly how much would it use tho. I used vanced for a long time without significant battery loss... |
Then maybe Vanced is able to change the playing stream seamlessly, but NewPipe is not and none of us has any idea how that could be achieved |
Wouldn't my previous suggestion work tho? Also how did vanced edit the original YT app |
YouTube app uses another type of video streams unsupported by newpipe as far as i know. it allows to disable video without stopping audio |
What another type? Do you mean HLS or separated video & audio? |
This issue is super annoying BTW. I think that we can just use 2 separate players for video and audio and when going to background mode just stop the video player. When going to picture-in-picture mode, we should continue playing the old video stream downscaled. And then asynchronously fetch the stream with smaller resolution and smoothly transition to it. YouTube Vanced and official app do that, and if NewPipe would support that too, then it would be the best YouTube app ever. |
This sounds great! I would really love to see this implemented. |
+1 please it's been months I'm going insane. |
This also happens when I click in 'Settings' and when I go back to the video from 'Settings' (this all inside the app). Hope this can be fixed. |
@Darkmaster006 I want to fix it so much, I know a bit of Kotlin & Java Android development, but unfortunately won't have free time for that any time soon |
See #2863 for earlier discussion around this. As stated there, this will have to wait until DASH is implemented in Newpipe. You are welcome to help test the DASH PR (#6537) for bugs so that it can be merged faster. :) There are 2 scenarios here: 1st is navigating within the app, and the 2nd is going outside the app (even phone locking counts as this). Possible solutions:
Seamless switching may require the video resolution of the main/popup players to be the same. |
I would just like to add that this happens both ways. Leaving a stream with video and entering it. Ok so if we fetch audio and video at the same time then suddenly we only need audio then we can drop the video stream but the audio should continue streaming seamlessly. There should not be a stutter in that case. If we enter the video stream then it would be understandable because suddenly we need to fetch the video stream. I think there should be a toggle in settings that would allow fetching a video stream in the background thus "wasting" more data. But the switch would be seamless. People - who actually know how to do this - should check what exactly happens when switching. Btw this could also be tied into the mobile internet toggle so it does not waste data. |
This is the nitpicky problem with newpipe I have. I like to play soundcloud music, but when switching between other apps, it jumps which is annoying. I do not understand why there is a jump as I don't see a reason to switch player type for audio-only content. |
So, according to @Stypox we don't currently have an idea of how to implement this functionality. After a little searching online i found this doc page from Google, and while avoiding their products is kinda the reason behind NewPipe, they do give full examples for how to implement seamless transition between the full-screen video player and a PiP video player and back. Found here: https://developer.android.com/guide/topics/ui/picture-in-picture Would it be possible to implement this in addition to the concept of dropping the video stream, but keeping the audio stream alive when the user wants to go from video to audio. This would reduce the need for the pause to only when the user is going from audio only to audio and video. |
is it a special type of audio player? most music apps have this feature. |
@peepopoggers You're playing it in the main player. If you play it in the background, then you won't have this issue. Background mode should be the default for audio-only services like Soundclound and Bandcamp, but for that we'll need someone to come forward and code the changes. |
I do play it in the background and it still skips while switching focus |
@peepopoggers Just tried it and there's no skip. Do you have a permanent notification while it is playing in the background? |
I do but it skips. It shows a little time glass icon when switching for a fourth of a second before unpausing again. |
@peepopoggers That only happens when you switch player type. Are you absolutely sure you're not tapping the thumbnail and opening the main player? Even if it has the headphone icon, it's not actually playing in the background. The icon is misleading and needs to be changed. Does it happen to you on Youtube as well? Playing in background, switching to another app, and noticing a pause? |
@opusforlife2 Alright that seems to work, I thought the headphone icon meant background. That sure is confusing and I think it needs to be changed. |
@opusforlife2 mpv does this as well. Maybe NP uses the same player as mpv and the problem is with that instead? |
@IHateTheProgrammingClass Why speculate on all that when you have a perfectly good PR right above you waiting to be tested? Check it out, it's awesome! |
Checklist
Steps to reproduce the bug
Actual behaviour
When I minimize the app, the audio stops playing for like 100-600ms and then resumes. It's pretty annoying.
When I reenter the app, the same thing happens.
Expected behavior
No pauses in the audio are expected.
Screenshots/Screen recordings
Recording on youtube
Logs
Device info
The text was updated successfully, but these errors were encountered: