Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): onPlayerStateChanged is not called when audio has completed playing #1523

Merged
merged 4 commits into from
May 29, 2023

Conversation

fzyzcjy
Copy link
Contributor

@fzyzcjy fzyzcjy commented May 29, 2023

Description

Close #1522

I am not sure whether this is the best way, but I can confirm it fixes the bug I see, and IMHO there are not infinitely many handler callbacks, so skipping this cancelation does not cause harm.

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

@Gustl22
Copy link
Collaborator

Gustl22 commented May 29, 2023

Nice catch!

Do you think updateRunnable?.let { handler.removeCallbacks(it) } would do the trick?

But I'm a bit confused about the comment below this, but it should't make a big difference, as the runnable (and it's loop) will end after one update circle. We may should test this once anyway :)

@Gustl22 Gustl22 changed the title Fix onPlayerStateChanged is not called when audio has completed playing fix: onPlayerStateChanged is not called when audio has completed playing May 29, 2023
@Gustl22 Gustl22 changed the title fix: onPlayerStateChanged is not called when audio has completed playing fix(android): onPlayerStateChanged is not called when audio has completed playing May 29, 2023
@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented May 29, 2023

Do you think updateRunnable?.let { handler.removeCallbacks(it) } would do the trick?

I am not sure. If it only removes that one specific runnable then maybe yes?

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented May 29, 2023

Btw this is partially why I do hope to implement #1527 - then there is no such callbacks, runnables, threads, etc!

@Gustl22 Gustl22 self-requested a review May 29, 2023 07:49
@Gustl22
Copy link
Collaborator

Gustl22 commented May 29, 2023

@fzyzcjy Is it ok for you to merge it like this (after my changes)?

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented May 29, 2023

LGTM! (not tested yet though)

@Gustl22 Gustl22 merged commit 293d6c0 into bluefireteam:main May 29, 2023
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.

(with PR) onPlayerStateChanged is not called when audio has completed playing
2 participants