advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
6.24k stars 437 forks source link

[Bug]: Iphone web app stutters then stops playing after a minute #2681

Closed twiclo closed 4 days ago

twiclo commented 6 months ago

Filing this bug here rather than the app repo because I'm using the PWA added to the home screen rather than the app installed through the app store. Let me know if I need to move it.

Describe the issue

When playing a book then sleeping the phone audio will play for about a minute before stuttering then it will stop playing audio. When you unlock the phone the media isn't paused but the time progression isn't moving either. Hitting pause then play again resumes playback

Steps to reproduce the issue

  1. Go to audiobookshelf instance on iphon
  2. Click share > Add to home screen
  3. Open new icon on home screen
  4. Play book
  5. Sleep phone

Audiobookshelf version

v2.7.2

How are you running audiobookshelf?

Debian/PPA

advplyr commented 6 months ago

What iOS version?

twiclo commented 6 months ago

17.3.1

advplyr commented 6 months ago

I'm not aware of anything we can do about this. This is not the case for me but I'm also not able to reproduce the other PWA issue reported #2655

It is just a basic HTML audio element and the PWA manifest has no settings for background audio that I'm aware of

twiclo commented 6 months ago

I just tried removing the bookmark and re-adding it and the issue persists. The icon did update when I did that though so that's nice. I can also confirm that it happens regardless of if the screen is slept or not.

advplyr commented 6 months ago

Now I'm confused about your original issue. Is your issue having to do with bookmarks?

What do you mean the icon updated? Which icon are you referring to?

I'm not sure what you mean with it happening regardless of it being asleep or not. Are you meaning just putting it in the background?

twiclo commented 6 months ago

Is your issue having to do with bookmarks?

When you hit share > add to homescreen ios calls that a bookmark. If you were to hit delete on the home screen icon it says "Are you sure you want to delete this bookmark?".

What do you mean the icon updated? Which icon are you referring to?

Originally when I added the bookmark/pwa to the home screen it was an low res icon with a white border. Maybe the favicon. Not sure. When I deleted the "bookmark" and re-added it to my homescreen the icon looked more like a real app

Are you meaning just putting it in the background?

When I first opened the issue I thought the screen had to be off for the issue to arise but I tested it again without sleeping the phone and it still broke. You can play a file and leave the phone on and focused on the web app and it will still break. When I get a chance I'll steal the phone again and test if this happens just in safari when it's not launched through the home screen as a "bookmark"

Sorry for the confusion

EDIT - It also breaks when played through safari and not through the home screen bookmark/pwa thing

twiclo commented 6 months ago

I just tested it with another book and am unable to reproduce it. The book I'm having an issue with is one big .m4b file. 207.61MB. The one that doesn't break is also one .m4b. It's 103MB. Let me know what I other info I can get you

advplyr commented 6 months ago

I see. Most likely the book that is breaking has to be transcoded because it can't be direct played. This is common if the audio file is not encoded properly. You can tell if the audiobook is being transcoded if you look at the server logs.

twiclo commented 6 months ago

What do I need to look for in the logs to see that? Is there some ffmpeg command that tells me the encoding type? What type is preferable?

advplyr commented 6 months ago

Yeah any ffmpeg log that shows up when you press play is transcoding to HLS. Otherwise we just serve the file directly and ffmpeg is not necessary

advplyr commented 3 months ago

Is this issue still specific to that one m4b or have you found others?