LeoKlaus / plappa

An Audiobook client for Jellyfin and AudioBookShelf, written in Swift/SwiftUI.
https://plappa.me
159 stars 0 forks source link

[BUG] Playback stop unexpectedly #74

Closed mrburns-42 closed 1 month ago

mrburns-42 commented 2 months ago

Describe the bug An audio book is started in the app and the app is then switched to the background. The smartphone is put to one side and is therefore locked. After the lock screen has been activated, the audiobook stops after a few seconds, but sometimes only after a few minutes.

If it is an audiobook with several files, it is also possible that the first x files can be listened to and then the audiobook stops at file x+1.

The error is usually not reproducible, as I can then start the audiobook again and it simply continues to run. Yesterday evening this didn't work either, but this morning with the same audiobook it did.

To Reproduce Steps to reproduce the behavior (For an audio book with one file):

  1. Go to an audiobook of your choice
  2. Click on Listen
  3. The audio book starts and can be heard
  4. The screen is locked and the audio book should run in the background.
  5. The audio book stops after a few seconds or minutes

If I then try to start the audio book again, the same thing happens, but not always. Sometimes it is also possible to continue listening.

Steps to reproduce the behavior (For an audio book with multiple file):

  1. Go to an audiobook of your choice
  2. Click on Listen
  3. The audio book starts and can be heard
  4. The screen is locked and the audio book should run in the background.
  5. At some point, the audiobook ends when a new file is started.

Expected behavior That I can listen to the audiobook without interruptions.

Logs [24.4.2024, 0:32] [CoreDataHandler] Initializing core data store... [24.4.2024, 0:32] [CoreDataHandler] CoreData store initialized [24.4.2024, 0:32] [PlaybackStateHandler] Syncing playback states through server [24.4.2024, 0:32] [StoreKitHandler] unlocked! [24.4.2024, 0:32] [AudioBookShelfAPIHandler] Successfully pushed playbackstates

Environment(please complete the following information):

Additional context My first thought was that something was wrong with the audiobook file. However, it can be played on other apps without any problems, and I have tried several of them. Last night, for example, I had an audiobook that I had tried to start at least five times and it just didn't work, even when I restarted the app. This morning, however, it worked without any problems.

The log files don't seem to say anything at all.

mrburns-42 commented 2 months ago

It also happens when you listen to something and do something different with the iPhone in the meantime. So not only when it is locked. I've just had this happen a good five times again, but this time with a different audiobook.

mrburns-42 commented 2 months ago

I have now observed this and was only able to reconstruct it for two cases:

  1. when I am connected to a HomePod via AirPlay.

Restarting the app doesn't help here, it still happens again. If I then connect to a Bluetoth speaker afterwards, playback works without the audiobook stopping unexpectedly. I have not yet tried whether the problem also occurs with AirPlay devices other than a HomePod.

  1. when I am connected to the car radio via WLAN & Bluetoth and use the app via CarPlay.

In this case, restarting the app is enough to solve the problem. This has rarely happened to me so far.

The error has not yet occurred under other conditions.

LeoKlaus commented 2 months ago

Thanks for the report and the update. I'm trying to reproduce this but have so far had no success with my HomePod and a multi-file audiobook.

Are the affected books downloaded or streamed?

mrburns-42 commented 2 months ago

The books are all downloaded. What I had forgotten during my update was that it now also occurs with audiobooks with one file.

On Saturday I reinstalled Plappa on my iPhone, since then I no longer have the problem ... but I haven't listened much since then. I'll keep an eye on it and report back even if the problem doesn't reappear in the next 7 to 14 days.

mrburns-42 commented 1 month ago

Okay, the error is back. The audiobook stops completely unspecifically after a few seconds or sometimes after a few minutes. Again, I was connected via AirPlay. Unfortunately, Plappa does not give me an error message under Get Debug Logs.

LeoKlaus commented 1 month ago

I've just released 1.1.5 build 7 to TestFlight. This build adds an observer to specifically check for failing playback and log that notification.

mrburns-42 commented 1 month ago

Yesterday evening I had the problem again several times, but unfortunately I don't get more than the following error message:

[4.5.2024, 23:49] [CoreDataHandler] Initializing core data store... [4.5.2024, 23:49] [CoreDataHandler] CoreData store initialized [4.5.2024, 23:49] [PlaybackStateHandler] Syncing playback states through server

I wonder if the app might just crash and stop playback. How can I tell whether the app has crashed or just stopped playing?

In the event of a crash, I would normally receive a message that the app has crashed, with the option of sending a crash report via Testflight, but I don't have that here.

LeoKlaus commented 1 month ago

If the app crashed, the logs would be reset and the player would disappear.

While playing in the background, nothing apart from playing and periodically pushing the current state is done, it really shouldn't crash.

I've tried to recreate this with a multitude of different files, downloaded or not and haven't been able to reproduce this so far (always streaming to a HomePod mini).

mrburns-42 commented 1 month ago

This issue was fixed with the improvements for large library's. I will close this ... thanks for your work on this.