The active session was not syncing with the server on startup, due to an assumption the player was initialized and PlayerHandler.getPlaybackSession() could be used
This lead to a scenario that when the player did sync with the server on the next sync, seek() was called, which was triggering playback to start
Upon investigation, I also found a situation where iOS being "smart" could attempt to restore playback when connecting Bluetooth headphones during app startup
This issue was solved by adding a guard to play and pause until the player is initialized
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/327
**Author:** [@ronaldheft](https://github.com/ronaldheft)
**Created:** 8/21/2022
**Status:** ✅ Merged
**Merged:** 8/21/2022
**Merged by:** [@advplyr](https://github.com/advplyr)
**Base:** `master` ← **Head:** `bug-ios-playback-on-session-resume`
---
### 📝 Commits (2)
- [`f335d87`](https://github.com/advplyr/audiobookshelf-app/commit/f335d8735f79a4208687638e83c9d336271f725b) Fix progress sync not updating playback object
- [`872931f`](https://github.com/advplyr/audiobookshelf-app/commit/872931f5077d4ae724fb24257bc5c6a422b62a01) Guard against player actions before player is initialized
### 📊 Changes
**3 files changed** (+22 additions, -5 deletions)
<details>
<summary>View changed files</summary>
📝 `ios/App/App/plugins/AbsAudioPlayer.swift` (+1 -1)
📝 `ios/App/Shared/player/AudioPlayer.swift` (+4 -0)
📝 `ios/App/Shared/player/PlayerProgress.swift` (+17 -4)
</details>
### 📄 Description
This turned out to be several problems:
1) The active session was not syncing with the server on startup, due to an assumption the player was initialized and `PlayerHandler.getPlaybackSession()` could be used
2) This lead to a scenario that when the player did sync with the server on the next sync, `seek()` was called, which was triggering playback to start
3) Upon investigation, I also found a situation where iOS being "smart" could attempt to restore playback when connecting Bluetooth headphones during app startup
4) This issue was solved by adding a guard to `play` and `pause` until the player is initialized
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/advplyr/audiobookshelf-app/pull/327
Author: @ronaldheft
Created: 8/21/2022
Status: ✅ Merged
Merged: 8/21/2022
Merged by: @advplyr
Base:
master← Head:bug-ios-playback-on-session-resume📝 Commits (2)
f335d87Fix progress sync not updating playback object872931fGuard against player actions before player is initialized📊 Changes
3 files changed (+22 additions, -5 deletions)
View changed files
📝
ios/App/App/plugins/AbsAudioPlayer.swift(+1 -1)📝
ios/App/Shared/player/AudioPlayer.swift(+4 -0)📝
ios/App/Shared/player/PlayerProgress.swift(+17 -4)📄 Description
This turned out to be several problems:
PlayerHandler.getPlaybackSession()could be usedseek()was called, which was triggering playback to startplayandpauseuntil the player is initialized🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.