LibreTube
LibreTube copied to clipboard
UI hangs on poor internet connection during video playing
Steps to reproduce
- Start a video playback.
- Wait until internet connection becomes poor enough so you have to wait until video buffer fills with data.
Expected behavior
While waiting until video buffer fills with data, we can show/hide video controls with taps, exit fullscreen mode and so on - perform normal operations with UI.
Actual behavior
UI hangs - taps don't result in video controls show/hide, you can't exit out of fullscreen mode and so on. Android even shows a system dialog with contents like "LibreTube isn't responding, wait or close?". Such behavior might indicate that some connection stuff might be implemented inside UI thread, so connection problems also cause UI hang.
LibreTube version
0.4.1
Android version
Android 11 (LineageOS 18.1)
Other details
No response
Acknowledgements
- [X] I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open issue.
- [X] I have written a short but informative title.
- [X] I will fill out all of the requested information in this form.
Could you please test this debug build and give feedback whether it improved/got worse/didn't change anything?
I tried it, it still hangs when the internet connection is poor.
Could you please test this debug build and give feedback whether it improved/got worse/didn't change anything?
Sorry, missed your message.
I tried it, it still hangs when the internet connection is poor.
Thanks!
Not sure what else we could do then, things that run on UI Thread have to to work properly and it's required for them to wait for the response of the API.
I suppose we can implement something like the following. When a UI thread needs to wait until some request from the API is finished, it calls such request asynchronously and just waits until the response is ready. With such approach, we can keep the UI responsive and, for example, display a loading animation. For example, when we load a webpage in a browser, the browser needs to wait until the response to display the page, but it doesn’t become unresponsive at the moment. Another example: when we start a PC/desktop app which requires a large amount of initialization on start, we usually see a splash screen, not an unresponsive app UI.
As for me, it’s a classical approach for such cases. Maybe I miss something and its inapplicable here? Please let me know. Thanks!
Well, that's what we're doing already in theory. All the stuff that works without having the video info is handled already while the video info is getting fetched. I've no idea how it could be improved, we should probably mark this as help wanted.