Sleep timer restart issues.
Not sure if this is a regression, but have noticed to issues.
The first is that restarting the sleep timer after it has ended (within the 15 second window) starts it when the fade out ends, instead of started, which seems to be a regression.
The other is that sometimes (and I can't seem to find out exactly when) the sleep timer will get applied on a new listening session long after the last timer ran out. For example, if I had the sleep timer on at night (probably extending it with the headphone button once or twice), the next morning, sometimes it is applied when I start playing the book again. I'll try to get a more accurate idea of when it is happening. Not really a problem, just odd.
I removed the seek back because it caused issues when the chapter sleep timer ended right after a chapter ended, but I will add a check. This seems to be related to the other issues that struggle with playback ending prematurely, please do investigate!
What version of iOS are you using?
18.1.1 currently
Ok these aren’t the best reproduction steps but I had the same issue today. The timeline of events are this:
- Using wired headphones, had the sleep timer on for 15 minutes and restarted once or twice in offline mode.
- Played through speakers with no sleep timer still in offline mode after 20-30 minutes after last session
- Played in car using CarPlay still in offline mode about 20 minutes after last session
- Played on Bluetooth headphones straight after getting out of the car. This also skipped backwards in time about 2 minutes (did not remember position) still in offline mode.
- Sleep timer faded out after about 15 minutes (I did not actually set a sleep timer at all)
- Manually pressed play in the app, and sleep timer reset to 3 minutes
- Cleared the sleep timer. Playback stopped again abruptly at end of chapter. The app did not crash.
I really don't understand why this is happening... I added a debug section to the top of the account sheet which tracks all stops and sleep timer expires, can you share its contents when this happens again?
Ok, so the code that suspends the sleep timer after it expires is the same as the one that suspends it when you pause, so it does not continue running. It returns before updating the DispatchTimerSource. Maybe it gets activated again or is still active because it is not updated. This could be the piece of code that is pausing playback.
Yeah it’s a hard issue to replicate. Could it be that CarPlay handles playing sessions differently than the app through the phone? Like is it treated a separate app? I notice if I was listening to music in my car, and then get back in my car, even if I listened to ShelfPlayer last, Spotify is loaded in the now playing section with the last song I was listening to.
Was skipping around chapters this morning and got this, I also hit update on the debug counter.
Yeah it’s a hard issue to replicate. Could it be that CarPlay handles playing sessions differently than the app through the phone? Like is it treated a separate app? I notice if I was listening to music in my car, and then get back in my car, even if I listened to ShelfPlayer last, Spotify is loaded in the now playing section with the last song I was listening to.
Not really, it’s probably just iOS preferring Music content. The player is the same
What you are seeing is probably caused by extend which has quadratic properties… I have to change that but it’s most likely not related to this.
I’ll keep testing, but this now seems to be fixed. Will close in a week if I don’t find any issues, but should be fine to close any time