advplyr / audiobookshelf

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

BUG/ENHANCEMENT: Make playable in iOS #180

Closed jsooter1 closed 2 years ago

jsooter1 commented 2 years ago

I understand that an App is forthcoming. Is there a web browser on iOS that can play the Audiobooks? In (my) Chrome and Safari, everything looks as though it works, but nothing plays and the timer only says 00:00.

Fantastic program! Great work! Looking forward to using it fully.

advplyr commented 2 years ago

I haven't actually tested on iOS but it should be playing in chrome. Are you using a reverse proxy?

jsooter1 commented 2 years ago

It does work in Chrome on Windows but not (for me) in Chrome (or Safari) on iOS. Tested both reverse proxied and with local address with the same results: Works in Chrome on a Windows laptop in and out of network but not on phone.

advplyr commented 2 years ago

Is the play button turning into a pause button? Are there any indicators that it is loading?

Can you watch the log while you try to play the audio and see if there are any errors popping up?

jsooter1 commented 2 years ago

Play button turns into Pause then quickly back to Play. There is an error in the log:

[2021-11-13T16:36:06.882Z] INFO: [SOCKET] Socket Connected KpirndWKn-dwfDXBAAAP [2021-11-13T16:36:18.562Z] INFO: [StreamManager] Open Stream Request KpirndWKn-dwfDXBAAAP kv8euh7g [2021-11-13T16:36:18.562Z] INFO: [STREAM] User has progress for audiobook 0.001 Time Remaining: 33043.673771s [2021-11-13T16:36:18.570Z] INFO: [STREAM] START STREAM - Num Segments: 5515 [2021-11-13T16:36:18.570Z] INFO: Stream Opened for client sooter for audiobook Better Off Dead with streamId kvy16qwv [2021-11-13T16:36:18.572Z] INFO: [STREAM] Starting Stream at startTime 0:16 (User startTime 0:46) and Segment #2

_[2021-11-13T16:36:18.579Z] INFO: [INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -ss 16.2s -noaccurate_seek -i /metadata/streams/kvy16qwv/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 2 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kvy16qwv/output-%d.ts /metadata/streams/kvy16qwv/final-output.m3u8_

[2021-11-13T16:36:18.579Z] INFO: [2021-11-13T16:36:20.581Z] INFO: [STREAM] kvy16qwv notifying client that stream is ready [2021-11-13T16:36:20.581Z] INFO: [STREAM-CHECK] Check Files 547 of 5515 9.92% Furthest Segment: 548 [2021-11-13T16:36:22.586Z] INFO: [STREAM-CHECK] Check Files 1305 of 5515 23.66% Furthest Segment: 1306 [2021-11-13T16:36:24.589Z] INFO: [STREAM-CHECK] Check Files 2058 of 5515 37.32% Furthest Segment: 2059 [2021-11-13T16:36:26.592Z] INFO: [STREAM-CHECK] Check Files 2781 of 5515 50.43% Furthest Segment: 2782 [2021-11-13T16:36:28.595Z] INFO: [STREAM-CHECK] Check Files 3462 of 5515 62.77% Furthest Segment: 3463 [2021-11-13T16:36:30.597Z] INFO: [STREAM-CHECK] Check Files 4097 of 5515 74.29% Furthest Segment: 4098 [2021-11-13T16:36:32.600Z] INFO: [STREAM-CHECK] Check Files 4682 of 5515 84.90% Furthest Segment: 4683 [2021-11-13T16:36:34.604Z] INFO: [STREAM-CHECK] Check Files 5255 of 5515 95.29% Furthest Segment: 5256 [2021-11-13T16:36:35.615Z] INFO: [FFMPEG] Transcoding ended

advplyr commented 2 years ago

That looks good, no errors. The docker log in Unraid incorrectly flags the ffmpeg as an error because it has the word "error" in it.

When you keep pressing play it keeps switching to pause and back? I'm wondering now if this has to do with the update I made yesterday. Were you experiencing this 2 days ago or later?

jsooter1 commented 2 years ago

I installed it in late August. I've never had it work on my phone. wish I had an Android to test with.

advplyr commented 2 years ago

I know that others have used it on iOS browser, maybe you have some ad blocker or something blocking the request?

I just pushed a patch from yesterdays update, it is probably worth pulling that on your server.

I also might suggest trying the Brave browser, this is my browser of choice and is on apple app store.

advplyr commented 2 years ago

I just got a hold of an iphone and have come across the issue you are talking about. Looking into it now

Update: I only tested in Safari and it turns out safari mobile still does not support Media Source Extensions, so safari will not be an option. I just ordered an iphone to test with, because the emulator will only allow safari.

advplyr commented 2 years ago

Just pushed v1.6.20 where audiobooks are now streamable in iOS on chrome or safari.

There are a lot of UI issues on mobile still, but this issue should be closed now.

timespaced commented 2 years ago

Play button turns into Pause then quickly back to Play. There is an error in the log:

[2021-11-13T16:36:06.882Z] INFO: [SOCKET] Socket Connected KpirndWKn-dwfDXBAAAP [2021-11-13T16:36:18.562Z] INFO: [StreamManager] Open Stream Request KpirndWKn-dwfDXBAAAP kv8euh7g [2021-11-13T16:36:18.562Z] INFO: [STREAM] User has progress for audiobook 0.001 Time Remaining: 33043.673771s [2021-11-13T16:36:18.570Z] INFO: [STREAM] START STREAM - Num Segments: 5515 [2021-11-13T16:36:18.570Z] INFO: Stream Opened for client sooter for audiobook Better Off Dead with streamId kvy16qwv [2021-11-13T16:36:18.572Z] INFO: [STREAM] Starting Stream at startTime 0:16 (User startTime 0:46) and Segment #2

_[2021-11-13T16:36:18.579Z] INFO: [INFO] FFMPEG transcoding started with command: ffmpeg -seek_timestamp 1 -f concat -safe 0 -ss 16.2s -noaccurate_seek -i /metadata/streams/kvy16qwv/files.txt -y -loglevel error -map 0:a -c:a copy -f hls -copyts -avoid_negative_ts make_non_negative -max_delay 5000000 -max_muxing_queue_size 2048 -hls_time 6 -hls_segment_type mpegts -start_number 2 -hls_playlist_type vod -hls_list_size 0 -hls_allow_cache 0 -hls_segment_filename /metadata/streams/kvy16qwv/output-%d.ts /metadata/streams/kvy16qwv/final-output.m3u8_

[2021-11-13T16:36:18.579Z] INFO: [2021-11-13T16:36:20.581Z] INFO: [STREAM] kvy16qwv notifying client that stream is ready [2021-11-13T16:36:20.581Z] INFO: [STREAM-CHECK] Check Files 547 of 5515 9.92% Furthest Segment: 548 [2021-11-13T16:36:22.586Z] INFO: [STREAM-CHECK] Check Files 1305 of 5515 23.66% Furthest Segment: 1306 [2021-11-13T16:36:24.589Z] INFO: [STREAM-CHECK] Check Files 2058 of 5515 37.32% Furthest Segment: 2059 [2021-11-13T16:36:26.592Z] INFO: [STREAM-CHECK] Check Files 2781 of 5515 50.43% Furthest Segment: 2782 [2021-11-13T16:36:28.595Z] INFO: [STREAM-CHECK] Check Files 3462 of 5515 62.77% Furthest Segment: 3463 [2021-11-13T16:36:30.597Z] INFO: [STREAM-CHECK] Check Files 4097 of 5515 74.29% Furthest Segment: 4098 [2021-11-13T16:36:32.600Z] INFO: [STREAM-CHECK] Check Files 4682 of 5515 84.90% Furthest Segment: 4683 [2021-11-13T16:36:34.604Z] INFO: [STREAM-CHECK] Check Files 5255 of 5515 95.29% Furthest Segment: 5256 [2021-11-13T16:36:35.615Z] INFO: [FFMPEG] Transcoding ended

I have the same issue, but with the iOS app. Playback "starts" (never actually starting) and the Play button change to Pause; after a few seconds, playback "stops" and play button changes back to play icon. No audio is streamed. Logs on Unraid Docker show the same as this person's logs.

Streaming via FireFox on my PC works flawlessly. Streaming via iOS browser, either FireFox or Safari, the stream has "hiccups" every second, where the audio cuts out for a fraction of a second, every second or so. Hard to explain. I don't care about that if I can get the app working. Happy to post a new bug report if you'd like.

Edit: I skipped my reverse proxy and went direct with IP:Port and streaming works now, but with the same cutting in/out as described when I use Safari or FireFox mobile browsers.

Edit 2: After more testing, the cutting in/out is only with one AudioBook. Happy to provide it for troubleshooting purposes (it works flawlessly with Plex + Prologue app). My other AudioBooks stream smoothly on the iOS app without the cutting in/out issue.

Related to the reverse proxy, does anyone have a config for pfsense HAProxy?

JHarding86 commented 1 year ago

I am also seeking a working HAProxy configuration for the websocket. I have followed the instructions here but to no avail: https://forum.netgate.com/topic/158983/websockets-configuration-in-haproxy/2?loggedin=true