You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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.
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.
The text was updated successfully, but these errors were encountered: