Copy link to clipboard
Copied
This is an existing bug that was recently noticed by a user. On android devices normally the volume buttons change the ringer volume. When a sound is played in air, it switches to a separate media volume setting as expected, and appears to stay this way for a few seconds afterward before switching back to ringer. The problem is when a user presses the home key to minimise the app before the cooldown period elapses to do something else, the volume gets stuck on media and stays that way, unless the user goes back to the app and the time elapses.
This is an issue for me since my app plays background music all the time, so the cooldown time never elapses and thus this bug always occurs on minimise. My guess is it has something to do with background music being enabled. Is there a way to disable background music?
Copy link to clipboard
Copied
Did you ever find a way to fix this?
Copy link to clipboard
Copied
Hi AdaptedArts,
You can use Event.DEACTIVATE event to stop the background music. Event.DEACTIVATE is called when the application loses focus e.g. phone call, press home button.
for example, if you have music playing in a sound channel then you can use the below code to stop music:
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, deactivateMusic);
function deactivateMusic(event:Event):void {
// application is now losing focus
musicChannel.stop(); // stops the music, "musicChannel is a SoundChannel"
}
Also, if you want to start the music again, then use Event.ACTIVATE event.
NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, activateMusic);
function activateMusic(event:Event):void {
musicChannel = mySong.play();
}
Hope this will helps.
Regards,
Nimit
Copy link to clipboard
Copied
I don't think you quite understood the issue, nimitja... It's not that the music doesn't stop, but rather that when using the device's volume control buttons (the physical ones) the device adjusts the media volume even when the app is minimized (and thus not playing music anymore) instead of adjusting the ringer volume.
For the record, I'm already doing what you suggested to stop all sounds upon minimizing
Copy link to clipboard
Copied
okay, that means when application is in background and sound is stopped, even then the volume control buttons are able to adjusts the sound volume. Please correct me if I am wrong.
I will recheck it again and let you know.
Regards,
Nimit
Copy link to clipboard
Copied
Yeap... App is in background, no sound is playing, but when you press the phone's physical volume button the Media volume is adjusted, not the Ringer volume as would be expected.
Copy link to clipboard
Copied
We are able to reproduce the problem. Could you please open a new bug report on this over at bugbase.adobe.com? Please include sample media, code if possible. Once the bug has been added would you mind posting back with the URL so that others affected can add their votes and comments?
Regards,
Nimit
Copy link to clipboard
Copied
Bug reported: https://bugbase.adobe.com/index.cfm?event=bug&id=3636989
Copy link to clipboard
Copied
Help, anyone? Please?