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

(Android) UI thread is blocked at end of playback while seeking to 0. #10

Closed
ryanheise opened this issue Dec 27, 2019 · 2 comments
Closed
Assignees

Comments

@ryanheise
Copy link
Owner

ryanheise commented Dec 27, 2019

This is a note to self.

In the finally block of the play thread, there is code to seek back to 0. This is a blocking call, but despite being executed in a background thread, it has the effect of blocking the UI thread. This is a mystery because seeking in other circumstances does not block the UI thread. This occurs both when playback naturally reaches the end of the file and also when stop() is explicitly called.

If I cannot work out the cause, it may be easiest to just remove the seek call such that the current position remains at the end of the file after playback completes. The user of the plugin can manually make a call to seek back to the start if they wish. This may be better because seeking on a network stream is slow, and not all use cases would want to perform this expensive seek operation after reaching the end of the file particularly if there is no intention to later continue playing from the start.

@ryanheise ryanheise self-assigned this Dec 27, 2019
@ryanheise ryanheise changed the title UI thread is blocked at end of playback while seeking to 0. (Android) UI thread is blocked at end of playback while seeking to 0. Dec 27, 2019
@ryanheise
Copy link
Owner Author

Fixed in latest code.

@github-actions
Copy link

github-actions bot commented Nov 8, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant