[PR #391] [MERGED] fix: Player sometimes pauses during seek on iOS #1426

Closed
opened 2026-04-24 23:58:22 +02:00 by adam · 0 comments
Owner

📋 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: masterHead: fix-ios-pause-during-seek


📝 Commits (1)

  • 9c9c1c3 fix: 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 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>
adam added the pull-request label 2026-04-24 23:58:22 +02:00
adam closed this issue 2026-04-24 23:58:23 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1426