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

AudioPlayer blocks UI on Andorid #7

Closed
ralph-bergmann opened this issue Feb 21, 2018 · 3 comments
Closed

AudioPlayer blocks UI on Andorid #7

ralph-bergmann opened this issue Feb 21, 2018 · 3 comments

Comments

@ralph-bergmann
Copy link
Contributor

The call to prepare() can take a long time to execute, because it might involve fetching and decoding media data. So, as is the case with any method that may take long to execute, you should never call it from your application's UI thread.

https://developer.android.com/guide/topics/media/mediaplayer.html#preparingasync

@luanpotter
Copy link
Member

Thanks for pointing it out, @the4thfloor ! Duly noted!

Indeed this needs to be fixed in the pursuit of a better user experience for audioplayers (and flame games).

I'm guessing just popping a new Thread and calling prepare() there should do the trick, but my knowledge of Android is not yet absolutely mastered, so I don't know if that's the best and most elegant solution.

Would you like to submit a PR?

@ralph-bergmann
Copy link
Contributor Author

I created a PR (#8)
it is a little bit more than expected :-(

luanpotter added a commit that referenced this issue Feb 27, 2018
@luanpotter
Copy link
Member

Released on 0.5.0

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

No branches or pull requests

2 participants