Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS book starts playing when app opens #973

Closed
1 of 2 tasks
mdeeter opened this issue Dec 7, 2023 · 55 comments
Closed
1 of 2 tasks

iOS book starts playing when app opens #973

mdeeter opened this issue Dec 7, 2023 · 55 comments
Labels
bug Something isn't working

Comments

@mdeeter
Copy link

mdeeter commented Dec 7, 2023

Steps to reproduce

  1. Listen to book (it's one I've downloaded)
  2. Pause book (typically done from lock screen, not sure if it matters)
  3. Hours later, open the app
  4. The last book will resume playing before the UI is finished loading

Expected behaviour

  • Preferred behavior: The book doesn't automatically start playing (or if some users want it to, make it configurable in the app settings to 'autoplay when opened'.
  • At the very least, I'd prefer if the book didn't start playing before the UI was loaded... it's playing before the player is even visible... so I have to wait for several seconds for the player UI to show up in order to pause the book.

Actual behaviour

  • Tell us what happens

Environment data

Audiobookshelf Version: 2.5.0

  • Android App?
  • iOS App? - version 0.9.68-beta

iOS Issue

iOS Version: 17.1.2

iPhone model: iPhone 12 Pro

@mdeeter mdeeter added the bug Something isn't working label Dec 7, 2023
@advplyr
Copy link
Owner

advplyr commented Dec 8, 2023

I'm not able to reproduce this. What version of the iOS app are you using?

Is this happening every time for you? Are you leaving the app open in the background or closing it?

@mdeeter
Copy link
Author

mdeeter commented Dec 9, 2023

app version 0.9.68-beta (updated in og description)

I typically always switch apps (leaving apps in the bg)... until something doesn't seem to be working, then I'll hard-close the app and re-open it.

It's happened several times in the past week, but it doesn't seem to happen all of the time... often enough to be a little annoying :)

@mdeeter
Copy link
Author

mdeeter commented Dec 9, 2023

Just happened again...

I put in my airpods... Unlocked my phone... Opened the app...

The book started playing immediately... Here's the ui

image

Then I try tapping on the book... But it won't open until the ui finishes loading...
image

Then the book opens (it's still playing) and there's no player UI showing...
image

I click play button and it pauses the book and it shows the player UI at the bottom...
image

@advplyr advplyr removed the waiting Waiting for OP label Dec 10, 2023
@KaiStarkk
Copy link
Contributor

It’s a weird one. I get the same issue. Doesn’t really bother me but still, curious.

@dathbe
Copy link

dathbe commented Dec 20, 2023

I experienced this same issue. Here are some additional details in case it is helpful in recreating:

I was listening to a book on my iPhone in the car via Bluetooth.
I then switched the car to play a different audio source (though I don't think I explicitly paused Audiobookshelf)
I then was listening on my phone to the same book via headphones.
I then paused the book in my phone.
I then listened to the book on my iPad via headphones.
I paused the iPad.
Both devices were put down for several hours, but the app was not killed on either device.
When I picked up the phone several hours later, this issue popped up.

The immediately-start-playing issue doesn't bother me too much (I would hate to have a fix for this prevent being able to get in and out of a car and continue listening without a bunch of button presses), but I experienced a secondary issue where the controls were not visible while the book was playing. Possibly the same as OP's "before the UI is finished loading."

P.S. I meant to mention that major kudos are deserved fro the developers of this app. This is one of the best if not the best open source iOS apps I've experienced. It looks beautiful, runs smoothly, and does what it's supposed to. This is the one bug that I've found so far.

@RealWalts
Copy link

RealWalts commented Dec 22, 2023

I also have the same issue, it used to happen before but seems to got fixed. But now it's back.
Also not a big issue, i usually just press play again and it continues with the controls.

@livineasy629
Copy link

This happens whether the book is downloaded or streaming. The streaming one is way more confusing because it starts playing the audio even before the server connects.

When I go to the book that's playing it shows as if it isn't playing.

This is also happening on the macOS client which seems to be the iOS app running on Mac. It randomly starts playing there and I can't get the play controls to come up so I have to quit the app.

I just updated the server app so I'll test it this week and report back.

@livineasy629
Copy link

Still present on the latest server version and updated iOS app. It will even continue playing a file that isn't downloaded while the server is disconnected.

@dathbe
Copy link

dathbe commented Jan 4, 2024

It will even continue playing a file that isn't downloaded while the server is disconnected.

This isn't too surprising. Presumably the app caches some duration while it's streaming. Would be interesting to know how long it will play when this happens.

@GiladHi
Copy link

GiladHi commented Feb 5, 2024

I also have the same issue with the latest version...

@mdeeter
Copy link
Author

mdeeter commented Feb 6, 2024

It will even continue playing a file that isn't downloaded while the server is disconnected.

This isn't too surprising. Presumably the app caches some duration while it's streaming. Would be interesting to know how long it will play when this happens.

In a recent play, I just left the house and left my wifi, I opened my app in the car and got about 3-5 min away when it stopped and I noticed it wasn't connected to my server. I killed the app and reconnected and it played fine.

I agree that it seems that the app is automatically playing from the cache. I think I'd prefer it if it wouldn't autoplay when I open the app.

@advplyr
Copy link
Owner

advplyr commented Feb 8, 2024

Is anyone able to reproduce this consistently yet? I'm trying to reproduce it again but unsuccessful so far.

By reproduce consistently I mean you are able to cause this to happen with a specific set of steps that you can share.

I've taken a guess at what could be happening while reading through the docs but I can't be sure until I can reproduce it. https://developer.apple.com/documentation/avfaudio/avaudiosession/interruptionreason/appwassuspended

@advplyr advplyr added the waiting Waiting for OP label Feb 8, 2024
@advplyr
Copy link
Owner

advplyr commented Feb 11, 2024

Let me know if this issue persists in 0.9.72-beta

@mdeeter
Copy link
Author

mdeeter commented Feb 11, 2024

I'll test it asap. I made attempts to trigger this intentionally (to try to gauge a cause/effect) for about 20 min yesterday and couldn't get it to happen. Then it happened (seemingly randomly) when I opened the app last night.... and then again just now when I opened up the app to check what version I had installed (0.9.71). I'll update again next week if I do or don't see it again (after updating).

@mdeeter
Copy link
Author

mdeeter commented Feb 15, 2024

So this is continuing to happen to me in the latest version (0.9.72). Idk if this is related, but I also experienced my current book starting to play at 1-2 AM seemingly on it's own.

This is really weird. I wonder if there's some logging that could be enabled (perhaps that I could opt-into) that could cache interactions that I could then send you (or upload here) to help triage this issue.

@dathbe
Copy link

dathbe commented Feb 15, 2024

If we're right that this is a caching issue, the server may not even know. Thus, logs may not be entirely useful.

@GiladHi
Copy link

GiladHi commented Feb 15, 2024

Still happened with the latest build, even with downloaded local files.

@advplyr
Copy link
Owner

advplyr commented Feb 15, 2024

The best way to figure this out is to find out how to reproduce it

@dathbe
Copy link

dathbe commented Feb 16, 2024

I experienced an extreme example of this last night where a book started playing randomly at midnight. The phone was otherwise sitting peacefully on my nightstand. When I opened the app to stop it, I was greeted with this:

2024-02-15 23-40-38 small

There was at least one, if not 2 more copies of the error message on the screen when I first opened it, and they were disappearing quickly. I didn't have my full senses about me, but I don't believe I had the option to stop the playback from within the app and had to force quit the app to get playback to stop (i.e., the playback controls were missing).

Steps to repeat:

  1. Open app from force-closed state
  2. Play book for about 2-5 minutes
  3. Pause book (I think i used the in-app controls for this, but it's possible I used the lock screen widget)
  4. Switch to a different app, but leave player open in background
  5. About 8 hours later, playback randomly restarted

I had not touched the app since pausing.

@RealWalts
Copy link

I experienced an extreme example of this last night where a book started playing randomly at midnight. The phone was otherwise sitting peacefully on my nightstand. When I opened the app to stop it, I was greeted with this:

There was at least one, if not 2 more copies of the error message on the screen when I first opened it, and they were disappearing quickly. I didn't have my full senses about me, but I don't believe I had the option to stop the playback from within the app and had to force quit the app to get playback to stop (i.e., the playback controls were missing).

Steps to repeat:

  1. Open app from force-closed state.
  2. Play book for about 2-5 minutes
  3. Pause book (I think i used the in-app controls for this, but it's possible I used the lock screen widget)
  4. About 8 hours later, playback randomly restarted

I had not touched the app since pausing.

It also started playing at night here as well randomly. It had been a few hours since I last used it.

@advplyr
Copy link
Owner

advplyr commented Feb 16, 2024

I know it was mentioned that this also happens while streaming but the screenshots I've seen so far have all been downloaded. Is it possible the streaming is a slightly different situation happening that is getting conflated with this one? Because that happens often and makes it difficult to narrow down the issue.

@dathbe
Copy link

dathbe commented Feb 16, 2024

This book was not downloaded -- at least not manually.

@advplyr
Copy link
Owner

advplyr commented Feb 27, 2024

@nigiriemoji Are you able to reproduce this consistently? To where you can give me an exact set of steps to reproduce it on my end?

@nigiriemoji
Copy link

@nigiriemoji Are you able to reproduce this consistently? To where you can give me an exact set of steps to reproduce it on my end?

@advplyr

I can sort of consistently reproduce it with many minutes/hours between each playback session. I just don’t know how many minutes to wait, but taking a night’s sleep usually is long enough. Just happened to me right now this morning.

  1. Open ABS app on iOS
  2. Play any audiobook
  3. Eventually manually pause it or set a sleep timer (I experienced bug both ways)
  4. Leave ABS app by swiping up to Home Screen, browse other apps, whatever. But ensure that the ABS app remains in the background but not fully closed (as in DO NOT swipe the app away to kill/terminate it in the app switcher screen)
  5. Don’t use ABS app for an hour or more (overnight sleep is long enough)
  6. Open up ABS app
  7. Experience automatic playback bug

@nigiriemoji
Copy link

Adding another recording of the bug. Haven’t used ABS app in several hours, feels like something to do with it being in the background for so long that it forgets its playback state?

RPReplay_Final1709105143.mp4

@dathbe
Copy link

dathbe commented Feb 28, 2024

I think the timing thing is important. I tried after about an hour and the app opened fine. But after 12 the bug occurred. Also, I left the app on the book screen (did not back out to the bookshelf) when I switched apps. That may or may not matter. So just pause and swipe up to switch apps, don’t press back to leave the book page.

@advplyr
Copy link
Owner

advplyr commented Feb 28, 2024

@nigiriemoji Are you able to reproduce this consistently? To where you can give me an exact set of steps to reproduce it on my end?

@advplyr

I can sort of consistently reproduce it with many minutes/hours between each playback session. I just don’t know how many minutes to wait, but taking a night’s sleep usually is long enough. Just happened to me right now this morning.

  1. Open ABS app on iOS
  2. Play any audiobook
  3. Eventually manually pause it or set a sleep timer (I experienced bug both ways)
  4. Leave ABS app by swiping up to Home Screen, browse other apps, whatever. But ensure that the ABS app remains in the background but not fully closed (as in DO NOT swipe the app away to kill/terminate it in the app switcher screen)
  5. Don’t use ABS app for an hour or more (overnight sleep is long enough)
  6. Open up ABS app
  7. Experience automatic playback bug

I tested this with a book streaming and let it play for about 10 minutes in the background with the screen off. I paused from the lock screen and just left the device for a little over 12 hours. I just unlocked the device and opened the app (that was still open in the background) and the bug did not occur.

I'm still on iOS 16.x, haven't updated to 17 yet. It seems everyone here is on 17 so maybe this bug started on newer iOS versions. Is anyone still on iOS 16 that is having this issue?

@dathbe
Copy link

dathbe commented Feb 28, 2024

I don't have any devices on ios 16 anymore. But try pausing from within the app and then switching apps.

@nigiriemoji
Copy link

@nigiriemoji Are you able to reproduce this consistently? To where you can give me an exact set of steps to reproduce it on my end?

I tested this with a book streaming and let it play for about 10 minutes in the background with the screen off. I paused from the lock screen and just left the device for a little over 12 hours. I just unlocked the device and opened the app (that was still open in the background) and the bug did not occur.

I'm still on iOS 16.x, haven't updated to 17 yet. It seems everyone here is on 17 so maybe this bug started on newer iOS versions. Is anyone still on iOS 16 that is having this issue?

Also on iOS 17 sorry. I typically pause directly within the app, though unsure what is the last screen/menu of the app that causes the bug

Any logs that I could provide to you the next time I encounter this bug?

@advplyr
Copy link
Owner

advplyr commented Feb 29, 2024

I tested pausing within the app and left it in the bg asleep for a day. Still not able to reproduce that on iOS 16.

I don't know about any logs that can provided

@mdeeter
Copy link
Author

mdeeter commented Feb 29, 2024

this still happens to me daily... any idea when you might be able to test on iOS 17?

@advplyr
Copy link
Owner

advplyr commented Feb 29, 2024

I have an iPhone 10 that is only used for testing and iOS 17 isn't supported for it. I will probably get a new one since these types of things are why I opened up donations.

@nigiriemoji
Copy link

This issue is still occurring for v0.9.73-beta iOS that came out in the last 48 hours.

@dathbe
Copy link

dathbe commented Mar 19, 2024

I had a weird situation this weekend where this bug popped up while I was in the middle of listening. I was running around, so I don't have the exact steps to reproduce, but generally I was listening, and then at some point while the audio was playing I opened the app to find that the controls had disappeared. When I clicked "stream" like I normally do when this bug pops up, the playback went back a couple minutes and started playing again with the control. Very odd.

@mdeeter
Copy link
Author

mdeeter commented Mar 19, 2024

I continue to have this bug on a daily basis. I'm assuming it won't get resolved until the devs have time/chance to test against iOS 17.

@advplyr
Copy link
Owner

advplyr commented Mar 19, 2024

Yeah I still have to buy a newer iphone

@dathbe
Copy link

dathbe commented Mar 19, 2024

Completely understand. I just wanted to add a new data point in case it's helpful in finding the issue.

I've only encountered the while-listening issue once, and I've just taken to force-closing the app when I'm done listening, so this bug doesn't really bother me. But it will be good to squash it.

@advplyr
Copy link
Owner

advplyr commented Mar 19, 2024

For sure, I appreciate the reports since we haven't narrowed down how exactly to reproduce this.

@mdeeter
Copy link
Author

mdeeter commented Apr 10, 2024

image

...More random playing in the middle of the night.

Same as mentioned above... Except that I didn't have to force-cc lose the app. I've been steaming this book... And paused the book around 830pm by removing my airpods. Was awoken to the app playing on its own at 230am.

@advplyr
Copy link
Owner

advplyr commented May 22, 2024

Can anyone confirm if this issue still exists in v0.9.74-beta?

@advplyr
Copy link
Owner

advplyr commented May 22, 2024

I bought a new iphone that is running ios17 and I haven't come across this yet

@dathbe
Copy link

dathbe commented May 22, 2024

I haven't had it happen on the latest update, but I also have gotten into the habit of force-closing the app when I'm done. Let me see if I can get it to happen again.

@nichwall
Copy link
Contributor

May have been inadvertently fixed by #1179?

@dathbe
Copy link

dathbe commented May 22, 2024

I'm going off a small sample size (1), but I did not get this error with the latest version after trying what had caused it before. So it's entirely possible 0.9.74 has a fix. Anyone else?

@nigiriemoji
Copy link

+1 seems to be fixed after three sessions

usually the bug was play book, sleep timer activates, come back to app ~1 hour later and auto play without input being the bug

no longer occurs

@advplyr
Copy link
Owner

advplyr commented May 23, 2024

Awesome thanks for testing and thanks to @indiefan for tracking that one down

@benonymity
Copy link
Contributor

I managed to get the playback error once yesterday in a whole day of listening, but far more rarely than before. Perhaps an unrelated issue, since I didn't have any unexpected resumes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants