jmshrv / finamp

A Jellyfin music client for mobile
Mozilla Public License 2.0
1.99k stars 130 forks source link

[Redesign][Feature Request] In player screen, show remaining song time instead of duration #664

Closed Ivanf1 closed 1 month ago

Ivanf1 commented 7 months ago

Hello! Coming from the Music app on iOS, in the player screen, I'm used to see the remaining time of the song currently being played instead of the duration.

What I would like to propose is to add a toggle in the settings that would allow to choose between the current behavior (show the total duration) or show the remaining time.

If this is something that you think could be worth to add, I could start working on it.

Chaphasilor commented 7 months ago

Hey! Yeah that sounds absolutely doable, and very straight-forward to implement! Just subtract the current position from the total duration at the right spot in the control area, and add the setting. Let me know if you want to handle it yourself, otherwise I can do it to!

Do you think the "time remaining" behavior should be the default on iOS, or should the default stay the same? Do other music apps like Spotify or Youtube Music also show the remaining time on iOS, or just the default music app?

Ivanf1 commented 7 months ago

Hi! I can't answer about the behavior of Youtube Music because I don't have a subscription for that. In Spotify, for me, the default behavior on iOS is to show the remaining time. For Finamp, also in the dynamic island and on the lock screen it shows the remaining time, so I think that making it the default behavior on iOS would would make the experience more uniform.

A problem I found by simply subtracting the current position from the total duration is that the two times will not update in sync. This behavior is the same as Spotify, you can see it in the following video.

https://github.com/jmshrv/finamp/assets/47425957/0c35acfa-9cf5-409e-804d-8250de9e3dfd

Apple Music (and the Music app in general) updates the times in sync, as can be seen in this video.

https://github.com/jmshrv/finamp/assets/47425957/41f0ac2c-35eb-47fe-a082-c098ccccea19

For the two videos the same song has been used. Note that the "Apple Music behavior" is also the same with Finamp on the dynamic island and the lock screen.

I, personally, prefer the way Apple Music does it. One way I found to implement this is to round down the duration of the song. For example if the song has a duration of 230217139 microseconds by rounding it to 230000000 and then just doing the subtraction as you suggested the two times are updated in sync. This rounding would be performed just for the display of the times.

Another way I think we could solve this is keeping a state with the time passed and the time remaining. Each time, before rendering the two values, we check if the new time passed and the new time remaining both differ from their previous values. If they do we render the new values, if they don't we render the old values. This would basically skip the frames were the two values would not update in sync. I haven't tried this solution yet.

What do you think would be the best solution?

Chaphasilor commented 7 months ago

Interesting that the behavior really is different between the platforms. You can test out Youtube Music's behavior without a subscription, it just won't allow background playback and will have ads afaik.

But yes, setting the default value of the setting to true for iOS sounds like a good idea then.
And the rounding is also the best approach I think, since the values are rounded down to seconds anyway. Maybe make sure the values actually are rounded and not just truncated, to prevent glitches in edge cases :)

Oh and don't forget to add the minus/hypthen as a prefix in that case, like the other apps do!

Ivanf1 commented 7 months ago

The default behavior on YouTube Music is to show the total duration and it does not seem to have an option to change it to the remaining time.

Chaphasilor commented 7 months ago

Okay, yeah that doesn't really surprise me. We can proceed as planned though 👌🏻

Chaphasilor commented 6 months ago

@Ivanf1 are you still planning on making a PR for this?

Ivanf1 commented 6 months ago

Hi! Unfortunately I don't have enough time to work on this issue anymore.

Chaphasilor commented 1 month ago

@Ivanf1 this is now part of the beta! There's still a bug with track longer than one hour, but that will also be fixed with the next update :)