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: Ensure any audio files that are playing when app exits are stopped & released #87

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

benvium
Copy link
Collaborator

@benvium benvium commented Dec 12, 2016

We noticed that on Android, if you attempt to pause an audio during the componentWillUnmount method of the root component, the pause method of RNSoundModule was never executed. In our case this was because the react-native-sound module was destroyed before the JS -> Java message to pause the audio came through.

This PR automatically stops and releases all MediaPlayer instances when React Native shuts down.

In the past, we've had odd exceptions during release of MediaPlayer, so the code below adopts a pretty defensive strategy.

Tested on Android 7.0, 6.0, and 4.4.4.

@paulmelnikow
Copy link
Collaborator

@benvium I've resolved the conflicts with master. Do you see any reason not to merge this?

@angelos3lex
Copy link

@paulmelnikow Isn't this a bug yet? If yes, could we merge it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants