There was a small gap during player re-initialization (which may happen if seeking to a different track in the queue) where the player was marked as initialized, but it hadn't started playing yet. This gap would allow a second seek operation (which could occur by rapidly pressing the skip button or multiple taps on the seek bar) to occur. However, since AVPlayer only allows once concurrent seek operation, the second seek operation would trigger a race condition where sometimes the second seek would execute before the first seek and the remaining initialization code (such as resuming playback) would never occur.
This PR fixes the issue by ensuring the player is not marked as initialized until all of the initialization code has run.
🔄 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/391
**Author:** [@ronaldheft](https://github.com/ronaldheft)
**Created:** 9/18/2022
**Status:** ✅ Merged
**Merged:** 9/23/2022
**Merged by:** [@advplyr](https://github.com/advplyr)
**Base:** `master` ← **Head:** `fix-ios-pause-during-seek`
---
### 📝 Commits (1)
- [`9c9c1c3`](https://github.com/advplyr/audiobookshelf-app/commit/9c9c1c3b946024d5472065df9f45967a238bbc7b) fix: Player sometimes pauses during seek
### 📊 Changes
**1 file changed** (+8 additions, -7 deletions)
<details>
<summary>View changed files</summary>
📝 `ios/App/Shared/player/AudioPlayer.swift` (+8 -7)
</details>
### 📄 Description
Fixes #354.
There was a small gap during player re-initialization (which may happen if seeking to a different track in the queue) where the player was marked as initialized, but it hadn't started playing yet. This gap would allow a second seek operation (which could occur by rapidly pressing the skip button or multiple taps on the seek bar) to occur. However, since `AVPlayer` only allows once concurrent seek operation, the second seek operation would trigger a race condition where sometimes the second seek would execute before the first seek and the remaining initialization code (such as resuming playback) would never occur.
This PR fixes the issue by ensuring the player is not marked as initialized until all of the initialization code has run.
---
<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/391
Author: @ronaldheft
Created: 9/18/2022
Status: ✅ Merged
Merged: 9/23/2022
Merged by: @advplyr
Base:
master← Head:fix-ios-pause-during-seek📝 Commits (1)
9c9c1c3fix: Player sometimes pauses during seek📊 Changes
1 file changed (+8 additions, -7 deletions)
View changed files
📝
ios/App/Shared/player/AudioPlayer.swift(+8 -7)📄 Description
Fixes #354.
There was a small gap during player re-initialization (which may happen if seeking to a different track in the queue) where the player was marked as initialized, but it hadn't started playing yet. This gap would allow a second seek operation (which could occur by rapidly pressing the skip button or multiple taps on the seek bar) to occur. However, since
AVPlayeronly allows once concurrent seek operation, the second seek operation would trigger a race condition where sometimes the second seek would execute before the first seek and the remaining initialization code (such as resuming playback) would never occur.This PR fixes the issue by ensuring the player is not marked as initialized until all of the initialization code has run.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.