Skip to content

fix: Race condition when playing/pausing audio#1705

Merged
Gustl22 merged 5 commits into
mainfrom
gustl22/1687-race-condition
Nov 20, 2023
Merged

fix: Race condition when playing/pausing audio#1705
Gustl22 merged 5 commits into
mainfrom
gustl22/1687-race-condition

Conversation

@Gustl22

@Gustl22 Gustl22 commented Nov 16, 2023

Copy link
Copy Markdown
Collaborator

Description

Fixes #1687

Instead we could also set the state always at the beginning of each method, but this raises these problems:

  • If the operation in the method throws an error, the state doesn't match the native players state
  • The state doesn't reflect the current real world audio state, as it's maybe still preparing/buffering and not actually playing

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, refactor:,
    docs:, chore:, test:, ci: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation and added dartdoc comments with ///, where necessary.
  • I have updated/added relevant examples in example.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Related Issues

#1687

@Gustl22 Gustl22 requested a review from spydon November 16, 2023 14:18

@spydon spydon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do the methods need to be split up into a private and a public method? 🤔

Comment thread packages/audioplayers/lib/src/audioplayer.dart
@Gustl22 Gustl22 merged commit 463b2a1 into main Nov 20, 2023
@Gustl22 Gustl22 deleted the gustl22/1687-race-condition branch November 20, 2023 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition when playing/pausing audio

2 participants