-
Notifications
You must be signed in to change notification settings - Fork 6k
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
EventListener isn't called in correct thread's looper #4332
Comments
That's more or less working as intended. ExoPlayer also requires you to call all methods on the thread the player was created on (or the main thread if it doesn't have a looper). See also the points under "threading model" here: http://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/ExoPlayer.html. The documentation is not as clear as it should be, and based on the discussion in #4278, we also just changed it to spell out the requirements more explicitly. |
Issue description
The document of method
Player#addListener
said:I did construct new SimpleExoPlayer instance within my own Looper (which is not
Looper.mainLooper()
). But when I callprepare()
media source on main thread,ExoPlayer
callback to all listeners within main thread instead of using my looper to dispatch the event.I can see the method
ExoPlayerImpl#updatePlaybackInfo
invoke listener's methods within caller thread, regardless the thread was used to construct the player.Reproduction steps
HandlerThread
and then createExoPlayer
object withinHandlerThread#onLooperPrepared
Player#addListener
Player#prepare
Link to test content
Can test with demo app.
Version of ExoPlayer being used
2.8.0
The text was updated successfully, but these errors were encountered: