Skip to content

fix(android): reset prepared state on player error#1425

Merged
Gustl22 merged 3 commits into
mainfrom
gustl22/1260-fix-android-error
Feb 14, 2023
Merged

fix(android): reset prepared state on player error#1425
Gustl22 merged 3 commits into
mainfrom
gustl22/1260-fix-android-error

Conversation

@Gustl22

@Gustl22 Gustl22 commented Feb 13, 2023

Copy link
Copy Markdown
Collaborator

Description

In the rare case, that an media player error occurs (like when playing unsupported media sources), the player still is in the "prepared" state, although the internal media state isn't anymore. Then it could keep calling methods, which lead to an illegal media player state. By resetting this variable on a media error, this should not make the library crash anymore, but still emit the error.

I would have added a test, but the crash is not reproducible with the library tests, only with an app integration / driver test, which is far too much overhead to implement.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs:, chore: 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

Fixes #1260
Fixes #1331

@Gustl22 Gustl22 marked this pull request as ready for review February 13, 2023 14:34
@Gustl22 Gustl22 changed the title fix(android): reset prepared state on player error (fixes #1260) fix(android): reset prepared state on player error (fixes #1260, fixes #1331) Feb 13, 2023
@Gustl22 Gustl22 changed the title fix(android): reset prepared state on player error (fixes #1260, fixes #1331) fix(android): reset prepared state on player error Feb 13, 2023
@Gustl22 Gustl22 requested review from luanpotter and spydon February 13, 2023 14:36
@Gustl22 Gustl22 merged commit 6f24c8f into main Feb 14, 2023
@Gustl22 Gustl22 deleted the gustl22/1260-fix-android-error branch February 14, 2023 13:43
@hig-dev

hig-dev commented Feb 16, 2023

Copy link
Copy Markdown

@Gustl22 @spydon Thanks for your work on this package.
When will this fix be released to pub.dev?

Edit:

I managed to use the updated version with a git dependency hig-dev@48f8750

@spydon

spydon commented Feb 16, 2023

Copy link
Copy Markdown
Member

@Gustl22 @spydon Thanks for your work on this package.
When will this fix be released to pub.dev?

Edit:

I managed to use the updated version with a git dependency hig-dev@48f8750

It will probably be a while until the next release since we now have AudioPool in both flame_audio and AudioPlayers, so we have to migrate away flame_audio from that first.

@hig-dev

hig-dev commented Feb 16, 2023

Copy link
Copy Markdown

@Gustl22 @spydon Thanks for your work on this package.
When will this fix be released to pub.dev?
Edit:
I managed to use the updated version with a git dependency hig-dev@48f8750

It will probably be a while until the next release since we now have AudioPool in both flame_audio and AudioPlayers, so we have to migrate away flame_audio from that first.

Thanks for the info. If anyone else needs the fix sooner, you can reference audioplayers in your pubspec.yaml in the meantime like follows:

  audioplayers:
    git:
      url: https://github.com/hig-dev/audioplayers.git
      ref: c028aab20f8533b71cd9fbb23e68751fabd88e57
      path:
        packages/audioplayers/

@Gustl22

Gustl22 commented Feb 16, 2023

Copy link
Copy Markdown
Collaborator Author

@hig-dev no need for your own branch:

Just can override dependencies in pubspec.yml like:

dependency_overrides:
  audioplayers:
    git:
      url: https://github.com/bluefireteam/audioplayers.git
      path: 'packages/audioplayers'
  audioplayers_platform_interface:
    git:
      url: https://github.com/bluefireteam/audioplayers.git
      path: 'packages/audioplayers_platform_interface'
  audioplayers_web:
    git:
      url: https://github.com/bluefireteam/audioplayers.git
      path: 'packages/audioplayers_web'
  audioplayers_linux:
    git:
      url: https://github.com/bluefireteam/audioplayers.git
      path: 'packages/audioplayers_linux'
  audioplayers_android:
    git:
      url: https://github.com/bluefireteam/audioplayers.git
      path: 'packages/audioplayers_android'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants