-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 playInBackground props in ExoPlayer #833
Conversation
After some investigation, the sound is killed after a certain time when running in background. We might need to implement something like this: |
Yes, pretty sure you will have to setup a service to support background operation. I know that react-native-track-player has support for this: |
playerNeedsSource = true; | ||
|
||
PlaybackParameters params = new PlaybackParameters(rate, 1f); | ||
player.setPlaybackParameters(params); | ||
} | ||
|
||
setPlayWhenReady(!isPaused); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this change made, I'm not sure what it does. When testing with my changes, the video plays automatically even if I switch sources.
This is covered already in the Android install instructions
I've cleaned this up a little, we were re-applying the paused status when playing in the background and then returning to the app. @moduval There was a change that I'm not sure why it was needed:
What was the reason for this? If it's needed, we can re-add it. When I tested, it worked fine without the change even if I switched to a new video. |
As stated by markusekblad on pull request #563, enabling the flag playInBackground cause the player to not play on startup even if props paused is set to false.
This pull request fix this problem.
Bonus: I updated the readme of android-exoplayer and added instruction on how to use exoplayer instead of default player on android.