LibreTube icon indicating copy to clipboard operation
LibreTube copied to clipboard

UI hangs on poor internet connection during video playing

Open kovdan01 opened this issue 2 years ago • 6 comments

Steps to reproduce

  1. Start a video playback.
  2. 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.

kovdan01 avatar Jul 25 '22 11:07 kovdan01

Could you please test this debug build and give feedback whether it improved/got worse/didn't change anything?

Bnyro avatar Jul 27 '22 10:07 Bnyro

I tried it, it still hangs when the internet connection is poor.

gianmarcogg03 avatar Aug 11 '22 12:08 gianmarcogg03

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!

kovdan01 avatar Aug 11 '22 12:08 kovdan01

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.

Bnyro avatar Aug 11 '22 12:08 Bnyro

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!

kovdan01 avatar Aug 12 '22 05:08 kovdan01

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.

Bnyro avatar Aug 12 '22 06:08 Bnyro