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

AudioManager.FLAG_PLAY_SOUND and sound device when changing the volume #15

Closed
guiyom19 opened this issue Feb 14, 2018 · 4 comments
Closed

Comments

@guiyom19
Copy link

Hi and thank you for this great library.
On Android, could you please make AudioManager.FLAG_PLAY_SOUND as a parameter in your setVolume method in the SystemSetting.java ?
My point is that I don't want to have the device sound when changing the volume.

Thanks!

@c19354837
Copy link
Owner

It's spring festival now, and I'll do it in the next week.

@c19354837 c19354837 reopened this Feb 18, 2018
@c19354837
Copy link
Owner

Which flag would you like to set?

In my phone (Meizu m2 note, Android 5.1), AudioManager.FLAG_PLAY_SOUND doesn't work.

@guiyom19
Copy link
Author

It works on a Samsung Galaxy A3 2017.
Line 197 am.setStreamVolume(volType, (int) (val * am.getStreamMaxVolume(volType)), AudioManager.FLAG_PLAY_SOUND);
I just wanted to choose if it's AudioManager.FLAG_PLAY_SOUND or 0.
But meanwhile, a figered another solution and don't use react-native-system-setting anymore that why I closed this issue.
But maybe it could be usefull for somebody else.

@c19354837
Copy link
Owner

V 1.2.2 has published.

Now you can control the sound like this:

SystemSetting.setVolume(0.5, {
    playSound: false
});

API have updated.

Thanks for your feedback.

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

No branches or pull requests

2 participants