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

[unified player] stop current video from preloading when trying to play another one #4232

Closed
panacist opened this issue Sep 4, 2020 · 24 comments · Fixed by #4246
Closed
Labels
feature request Issue is related to a feature in the app

Comments

@panacist
Copy link

panacist commented Sep 4, 2020

Describe the feature you want

i think it would be nice to stop playing the actual video when choosing to play another not after it's fully loaded this way we won't be looking at the comments section of a video and another is being played on the background.

Is your feature request related to a problem? Please describe it

i don't know maybe?

Additional context

nothing..

How will you/everyone benefit from this feature?

every other app does this so newpipe should as well?
well i guess it's helpful because it's what everyone expects to happen !

@panacist panacist added the feature request Issue is related to a feature in the app label Sep 4, 2020
@opusforlife2
Copy link
Collaborator

Why does it matter? The current way, you get less of a gap where you're left staring at the screen waiting for things to load. You get to enjoy the video until the new one is ready.

@panacist
Copy link
Author

panacist commented Sep 4, 2020

@opusforlife2 it does matter because sometimes you don't enjoy the current playing video that's why you start playing another ?

@opusforlife2
Copy link
Collaborator

Pause it before playing another. 🤭

@panacist
Copy link
Author

panacist commented Sep 4, 2020

@opusforlife2 yeah that's an option but it doesn't solve the issue permenantly (the youtube app does solve it tho)

@opusforlife2
Copy link
Collaborator

The Youtube app uses proprietary code to directly access the Google servers and fetch videos. So they can do this super fast. Newpipe has to first obtain data from the website and then fetch the video details, which means we can never be as fast as Youtube at fetching videos. So there's no point in comparing the two.

@panacist
Copy link
Author

panacist commented Sep 4, 2020

@opusforlife2 i know that and i think you missing the point! what am saying is not to fetch videos as fast as youtube. am saying have some mechanism to stop the ongoing video whenever another video's tumbnail is pressed

@opusforlife2
Copy link
Collaborator

My opinion is:

Pause it before playing another. 🤭

So let's wait until more people weigh in on this.

@vkay94
Copy link
Contributor

vkay94 commented Sep 4, 2020

What about an option (SwitchPreference) in preferences under "video and audio" regarding this behavior?

@avently
Copy link
Contributor

avently commented Sep 5, 2020

@opusforlife2 I agree with all your comments here. Actually I didn't pause a video just because of the silent gap between streams. Without pause it feels like a kind of instant playback

@opusforlife2
Copy link
Collaborator

@avently Yep. I consider it a feature, not a bug.

@panacist
Copy link
Author

panacist commented Sep 5, 2020

@avently @opusforlife2 i can't agree enough but i'm raising this issue because sometimes i have terrible internet (or for those using tor or vpn) considering the amount of time the app takes to fetsh the video, Retrieve the comments and recommended videos there's a huge amount of delay here ranging from a few seconds to minutes !
there's no need for me to keep playing the other video (which takes a considarable amount of memory and cache). that's all what i'm trying to say and what i am familiar with on other apps but if you feel like a production oriented philosophy is good for you go for it guys.

@avently
Copy link
Contributor

avently commented Sep 5, 2020

I don't think you'll get better results in terms of delay before next video if you just stop playback instead of loading in parallel. You can try it yourself and to compare with current behavior. Just stop playback via notification and than choose another video, compare the delay. Or pause and select another video

@opusforlife2
Copy link
Collaborator

I think the question here, @avently, is that does the current video stop loading when you open a new one? @panacist is concerned about the data usage. If the app keeps playing the already buffered video, but stops downloading more of it when you open another one, he should be fine.

Am I correct, @panacist?

@panacist
Copy link
Author

panacist commented Sep 5, 2020

@opusforlife2 yess!! thtat's exactly what am trying to say keep loading the actuall video when not needed takes a nontrivial amount of data memory and cache for those who have bad internet connection and old phones.

@avently
Copy link
Contributor

avently commented Sep 5, 2020

@opusforlife2 the player always preloads some parts of a video and at some point of timeline IR doesn't load anything but at some point it loads next part.
The answer is no, the player don't stop prealoading.

@opusforlife2
Copy link
Collaborator

Hmmm. Is it possible to programmatically stop preloading when another video is opened?

@vkay94
Copy link
Contributor

vkay94 commented Sep 5, 2020

@opusforlife2 in fact it is (I tried it myself some hours ago) but I doubt it is good practice.
If you add playerService.stop(false) to the beginning of VideoDetailFragment#selectAndLoadVideo (link), the video/service stops but the latest frame remains until the new video has been enqueued/starts to buffer.

@opusforlife2
Copy link
Collaborator

From this line it looks like playerService.stop stops the actual player, not just the preloading/buffering part.

@avently
Copy link
Contributor

avently commented Sep 6, 2020

@vkay94 there is hideMainPlayer() for stopping without issues. But it still not allowing to continue playing with just disabled preloading, i'm not sure how to do it in exoplayer

@avently
Copy link
Contributor

avently commented Sep 6, 2020

Try this apk. Should work fine. The toast will tell you when preload is enabled or disabled. You can also check with any network monitor.

preload.zip

@avently
Copy link
Contributor

avently commented Sep 7, 2020

PR #4246

@opusforlife2
Copy link
Collaborator

Didn't you test the apk, @panacist?

@panacist
Copy link
Author

panacist commented Sep 8, 2020

@avently thank you for working on that really appriciate it !
@opusforlife2 yeah it does work as expected (although i still think stopping the actual player is the best thing to do but we will see other users impressions once the new version is released :) )

@panacist panacist closed this as completed Sep 8, 2020
@opusforlife2
Copy link
Collaborator

The issue will be closed automatically when the PR is merged.

@opusforlife2 opusforlife2 reopened this Sep 8, 2020
@opusforlife2 opusforlife2 changed the title [unified player] stop the actual playing video when trying to play another one [unified player] stop current video from preloading when trying to play another one Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issue is related to a feature in the app
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants