jarnedemeulemeester / findroid

Third-party native Jellyfin Android app
GNU General Public License v3.0
2.67k stars 167 forks source link

TV playback controls: add fast seeking and enable track selection without pausing #870

Open voodoos opened 3 weeks ago

voodoos commented 3 weeks ago

Hi @jarnedemeulemeester thanks a lot for your work ! I am using the Android TV version of Findroid because the playback is much more robust than the official one. But I found the controls to be a bit finicky... here is a proposition to improve them a bit, adding fast seeking and track switching without pause. I hope this is of interest to you ! It is my first time using Compose so I would be happy to receive feedback and improve my code.

This PR proposes an addition to the current playback controls to allow seeking and changing tracks without pausing the playback.

The current controls are especially tedious to use for seeking:

  1. First press the Enter key to pause to show the controls. This also pauses the playback.
  2. Navigate to the seeker (right then bottom).
  3. Activate seeking by pressing Enter.
  4. Seek by pressing multiple times Right or Left.
  5. Validate by pressing Enter.
  6. Press Enter to resume the playback.

This PR adds two new behaviors:

  1. Fast-seeking by pressing Right or Left keys during playback while the controls are not shown.
  2. During, playback, pressing the Up shows the controls without pausing the playback which allows changing the audio or subtitle tracks without pausing.

However, I had to inhibit several current behaviors to achieve that:

Here is a screencast showing seeking and switching subtitles without pausing:

voodoos commented 3 weeks ago

I see that linting fails due to some style issues (and missing imports). Is there anyway for me to configure my Android Studio to enforce these styles ?

jarnedemeulemeester commented 2 weeks ago

I see that linting fails due to some style issues (and missing imports). Is there anyway for me to configure my Android Studio to enforce these styles ?

I don't know of a way to show the linting errors in Android Studio. However you can run ./gradlew ktlintFormat to check and lint your code

jarnedemeulemeester commented 2 weeks ago

I like the changes to open up the controls without pausing the playback. But I am not sure if coupling isPlaying to the user interaction is a good idea. What if the playback get's pause by the mediasession from for example a phone or something?

voodoos commented 2 weeks ago

But I am not sure if coupling isPlaying to the user interaction is a good idea. What if the playback get's pause by the mediasession from for example a phone or something?

I think you're right, it's not completely satisfying right now, and I noticed some strange behavior sometimes when sending some inputs right after starting the videos that might be linked to that. I will try to rework it in the following weeks. I do think we need to have some kind of fast seeking that doesn't have to show the controls however, not sure how that can be achieved...