jwkent / AudioWebApp

An audio web app
2 stars 2 forks source link

Android Audio player (from dropdown menu) shows End timestamp while playback #94

Closed javierxio closed 3 months ago

javierxio commented 3 months ago

When phone is unlocked and pull down the menu, the audio player is showing the end timestamp during playback. When the audio is paused, the correct timestamp shows and correct position in the seekbar.

During playback (bug):

image

While paused (shows correct):

image

benjkent commented 3 months ago

Underlying browser and Android version?

benjkent commented 3 months ago

https://w3c.github.io/mediasession/#position-state Not saying it's not possible, but the spec says UserAgent MAY. IOS seems to not have issues with obtaining or maintaining position state. We just need more information regarding OS version and underlying browser (even if the chrome is not being shown). Bottom line is if there is a solution we will implement it.

javierxio commented 3 months ago

@benjkent android 12, chrome browser. although my other phone (android 14, vanadium browser) shows a different behavior (mainly no timestamps/lengths):

Screenshot_20240320-202413 Screenshot_20240320-202421

benjkent commented 3 months ago

After many attempts to duplicate your issue. I believe at this point, the sleep - wake issue of not displaying / maintaining "current or last position" stems from some aspect of the Android OS. I base this theory on the fact that when the device wakes the actual control has been severed earlier by the "sleep" state. While the media-session is still displaying in pulldown menu due to the browser or webapp still in state.

  1. When - on multiple devices and Android versions - I wake device from sleep and swipe down. The media session shows controls and Metadata, but when interacting with media session controls, it goes directly to the running application.
  2. When swiping down again I have full control of TNP player with media session controls. Hence, the feeling that the completed duration you are seeing is based on meta data which is the default and the OS trying its best to interpret this data and reflect it in the media session.
  3. The best course of action is to find comparable site that is using HTML
javierxio commented 3 months ago

Thanks for looking into it. It's not a big deal so I am ok with closing the ticket. The app will save the timestamp anyway so that is good.

benjkent commented 3 months ago

I feel that there are others that may be frustrated by this issue too. Ultimately, after looking at quite a few other audio projects and their use of the media-session actions, the issue seem to get glossed over. Kind of like cool there it, but no real in-depth dive. Let's keep this issue in mind as the app develops. As Media session API develops a solution may present itself.