Closed mrburns-42 closed 1 week ago
Thank you for reporting this.
Are you trying to play the book from the detail screen or the context menu (from home or the books tab)?
Can you get the debug logs after trying to play a book and post them here (best from 1.1.3, I've improved logging with that update)?
The book was started from the home, but it does not work from the books tab either.
Here are the debug logs:
[22.4.2024, 22:48] [CoreDataHandler] Initializing core data store... [22.4.2024, 22:48] [CoreDataHandler] CoreData store initialized [22.4.2024, 22:48] [PlaybackStateHandler] Syncing playback states through server [22.4.2024, 22:48] [ReadingListHandler] Found no objects in reading list [22.4.2024, 22:48] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.AuthenticationError error 0.) unexpected(code: 401) [22.4.2024, 22:48] [StoreKitHandler] unlocked!
Same iPhone, with a completely fresh installation. It is also not possible to start an audio book, but now the error is slightly different. Previously the chapters of an audiobook were loaded, now the chapters are also not loaded ... tried with several audiobooks. Here too, it is not possible to start the audiobook when you click on Listen.
Here are the debug logs:
[24.4.2024, 7:46] [CoreDataHandler] Initializing core data store... [24.4.2024, 7:46] [CoreDataHandler] CoreData store initialized [24.4.2024, 7:46] [PlaybackStateHandler] Syncing playback states through server [24.4.2024, 7:46] [ReadingListHandler] Found no objects in reading list [24.4.2024, 7:46] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.AuthenticationError error 0.) unexpected(code: 401) [24.4.2024, 7:46] [StoreKitHandler] unlocked! [24.4.2024, 7:46] [SoundHandler] Tried to play chapter without fileURL
I forgot, here is another screenshot:
This line
[24.4.2024, 7:46] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.AuthenticationError error 0.) unexpected(code: 401)
Indicates a permission issue. Can you make sure that the user has the "Can Download" permission?
The user already had the rights, here are the rights he has:
Before he reinstalled the app, he was also able to download the audiobooks. After the download, he could not start them. The chapters only stopped loading after the reinstallation.
The chapters were probably cached before the reinstallation.
Can you try the same user on a different device or a different user on that device?
I'm assuming other users/devices still work with your server?
It works on another device. Other users can also use the server without any problems.
This line
[24.4.2024, 7:46] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.AuthenticationError error 0.) unexpected(code: 401)
Indicates a permission issue. Can you make sure that the user has the "Can Download" permission?
I had overlooked that part, sorry. This error message occurred before and after the reinstallation. He had the download rights at all times and it also works with his account on an iPad.
I am having a similar issue. I have found that I can start audiobooks again after logging out and logging back into Plappa. Playback directly from Audiobookshelf is working as expected. The user is an admin user with all permissions.
Device: iPhoneXR OS: iOS 17.4.1 Version 2.9.0 Server Version Audiobookshelf 2.9.0
Logs (Plappa): [1/5/2024, 10:22] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.AuthenticationError error 0.) unexpected(code: 401)
And here's the relevant section from my Audiobookshelf Logs: [2024-05-01 09:34:40.055] INFO: [SocketAuthority] Socket Connected dQiIbvG0X7yxT0e9AAAZ [2024-05-01 09:55:10.499] INFO: [SocketAuthority] Socket Connected Xp_hoyw9q0eX5xyzAAAb [2024-05-01 10:02:14.471] INFO: [SocketAuthority] Socket dQiIbvG0X7yxT0e9AAAZ disconnected from client "user1" after 1654416ms (Reason: ping timeout) [2024-05-01 10:07:31.735] INFO: [SocketAuthority] Socket Connected SoZSica-i7efipAKAAAd [2024-05-01 10:07:39.233] INFO: [SocketAuthority] Socket Xp_hoyw9q0eX5xyzAAAb disconnected from client "user2" after 748735ms (Reason: ping timeout) [2024-05-01 10:08:41.847] INFO: [SocketAuthority] Socket SoZSica-i7efipAKAAAd disconnected from client "user2" after 70112ms (Reason: ping timeout) [2024-05-01 10:08:45.557] INFO: [SocketAuthority] Socket Connected O1ZEAJqpkE6Yr3FKAAAf [2024-05-01 10:22:05.556] INFO: [SocketAuthority] Socket Connected 5KDxFZ-etR080LnxAAAh [2024-05-01 10:23:16.104] INFO: [SocketAuthority] Socket 5KDxFZ-etR080LnxAAAh disconnected from client "user2" after 70548ms (Reason: ping timeout)
Thanks for adding the ABS logs. I hoped for some kind of reasoning for the 401...
This is really weird, especially considering it seems to work after reconnecting... It's not like plappa would make different requests after the first launch.
Indeed - I will continue to troubleshoot (probably tonight or tomorrow) in case there is additionally a problem on my end, for example with my traefik configuration, but the fact I can continue to access and use the audiobookshelf service via the browser points me towards Plappa (or my configuration of Plappa) as the culprit. This behavior is happening on two devices (both iPhoneXR, same ios) with two separate users.
You can use the following curl commands to recreate what plappa is doing:
Login
curl --request POST \
--url https://your.abs.server/login \
--header 'Content-Type: application/json' \
--data '{
"username": "demo",
"password": "demo"
}'
From that response, you'll need the "token" to authorize other requests:
...
"type": "user",
"token": "eyJh...tpcOGEk",
"mediaProgress": [
...
Request libraries
curl --request GET \
--url https://your.abs.server/api/libraries \
--header 'Authorization: Bearer eyJh...OGEk'
From that response, grab the id of the library you're having issues with:
"libraries": [
{
"id": "b4a0c2be-65dd-4789-8081-db7ba63917dc",
"oldLibraryId": null,
"name": "Hörbücher",
Then you can query for library items (this is what plappa does on startup to fetch new entries):
curl --request GET \
--url https://your.abs.server/api/libraries/b4a0c2be-65dd-4789-8081-db7ba63917dc/items \
--header 'Authorization: Bearer eyJh...EeXz0'
This is the request that fails in your case, causing the error. The response should look like this:
{
"results": [
{...}
],
"total": 11,
"limit": 0,
"page": 0,
"sortDesc": false,
"mediaType": "book",
"minified": false,
"collapseseries": false,
"include": "",
"offset": 0
}
I have now tried this about 20 times with curl and it works every time.
I was able to reconstruct the error in the app on my iPad: Logged in with an account, everything worked. Then logged out again and logged in again. After a few times, the error occurred again. Perhaps you will be able to reconstruct this.
Ok, so for me I think I have managed to solve the issue (with a small facepalm) by making sure that I am logging in using https - my traefik configuration is set to force https, and I previously left plappa on the default http for login to ABS. I logged back in via https yesterday and it continues to work today (perhaps https should be the default?).
I will update if this turns out to not be the case.
@zackbresler That was a good point and I tried it out straight away.
If I connect with http instead of https, it still works. This is despite the fact that the configuration also always forces https. So it seems to be a different error in my case.
Incidentally, I use caddy as a reverse proxy.
I've tried it too, but managed to connect and play files.
I've tried signing out and in about 10 times, with no sign of playback failing. I'm currently working on improved error reporting from the player session and will upload a TestFlight build shortly.
@LeoKlaus Please let me know when you are ready. I will then try it out again on different devices.
I've just released 1.1.5 build 5 to TestFlight. It includes added error handling for failing playback, let me know if that added anything.
Okay, I have testet it with version 1.1.5., several times. The chapters were loaded correctly every time, but it was not possible to start a book every time. The book was also streamed. I received the following error message:
[2.5.2024, 15:16] [CoreDataHandler] Initializing core data store... [2.5.2024, 15:16] [CoreDataHandler] CoreData store initialized [2.5.2024, 15:16] [PlaybackStateHandler] Syncing playback states through server [2.5.2024, 15:16] [AudioBookShelfAPIHandler] Successfully pushed playbackstates [2.5.2024, 15:16] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.APIError error 0.) notAuthenticated [2.5.2024, 15:16] [JellyfinAPIHandler] Couldn't connect to server: Could not connect to the server. [2.5.2024, 15:16] [AudioBookShelfAPIHandler] Successfully pushed playbackstates [2.5.2024, 15:16] [AudioBookShelfAPIHandler] Couldn't connect to server: Could not connect to the server. [2.5.2024, 15:16] [PlaybackStateHandler] Syncing playback states through server [2.5.2024, 15:16] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.APIError error 0.) notAuthenticated [2.5.2024, 15:16] [SoundHandler] Tried to play chapter without fileURL [2.5.2024, 15:17] [SoundHandler] Tried to play chapter without fileURL [2.5.2024, 15:17] [SoundHandler] Tried to play chapter without fileURL [2.5.2024, 15:17] [SoundHandler] Tried to play chapter without fileURL [2.5.2024, 15:17] [SoundHandler] Tried to play chapter without fileURL [2.5.2024, 15:17] [AudioBookShelfAPIHandler] Successfully pushed playbackstates
I will continue testing and try to reconstruct the error in the original variant.
Forgotten: I can download books and then start them. As I said, it is currently different from the beginning of my bug report.
It's been a while and the 1.2.0 update has since completely changed the way files are handled internally, so I believe this issue is no longer relevant.
If you still experience this, please reopen.
Describe the bug Audiobooks, whether downloaded or streamed, cannot be started.
To Reproduce Steps to reproduce the behavior:
Expected behavior That the audio book is started and you can listen to it.
Logs Coming soon
Environment(please complete the following information):
Additional context I tested the same thing on an iPhone 15 Pro with iOS 17 and the audiobook started without a problem.