volumeUp and volumeDown keys event "consumed by the views"

I seem to be unable to get the Kindle Fire HD 8.9 (probably other Kindle variants as well) to handle the hardware volume keys properly.

When a Corona app is running and does not use a key event listener at all, the OS volume indicator displays, but the main volume (from the Corona app) does not change.

When non-Corona apps are running, the volume indicator displays and the volume changes as the up/down keys are pressed.

This behavior can be verified by running a Corona app that loops an audio stream and does not have any key event listeners.  Other apps (Silk Browser, YouTube, pretty much anything else) allow the OS to handle the volume as expected.

Here is a sample main.lua that exhibits the behavior.  You will need to supply your own SampleLoop.mp3 file.

local function playSong() local song = audio.loadStream( "SampleLoop.mp3" ) audio.play( song, { channel=1, loops=-1 } ) print( "playSong: song playing" ) end local function init() -- Runtime:addEventListener( "key", onKeyEvent ) playSong() end init() 

console output when run on Kindle Fire HD 8.9: 

D/PhoneWindow( 8432): superDispatchKeyEvent. key event has been consumed by the views. keyCode: 25 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 3, index 18 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 3, device 2, volume 2.000000, delay 0 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 9, index 18 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 9, device 2, volume 2.000000, delay 0 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 2, index 18 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 2, device 2, volume 2.000000, delay 0 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 5, index 18 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 5, device 2, volume 2.000000, delay 0 I/AudioFlinger(31231): set smart gain 2 dB D/PhoneWindow( 8432): superDispatchKeyEvent. key event has been consumed by the views. keyCode: 25 I/AudioPolicyManagerBase(31231): startOutput() output 1, stream 5, session 99 I/AudioPolicyManagerBase(31231): stopOutput() output 1, stream 5, session 99 D/PhoneWindow( 8432): superDispatchKeyEvent. key event has been consumed by the views. keyCode: 25 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 2, index 17 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 2, device 2, volume 0.000000, delay 0 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 5, index 17 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 5, device 2, volume 0.000000, delay 0 D/PhoneWindow( 8432): superDispatchKeyEvent. key event has been consumed by the views. keyCode: 25 I/AudioPolicyManagerBase(31231): startOutput() output 1, stream 5, session 99

Hi @tonygod,

Just to confirm, in your tests, the hardware buttons do nothing in regards to the volume of the audio playing within Corona? As in, you can turn it down to the lowest volume level, and the song is still playing loudly? That seems very odd and would need to be investigated further…

Thanks,

Brent

Yes, that is what I am observing on my hardware.  I only have the one Kindle Fire HD 8.9 though, so I do not know if it is true of other Kindle devices.

Hi @tonygod,

Can you build and run one of Corona’s sample apps as-is on your Kindle Fire? Our “Media/SimpleMixer” app would be a good choice. We need to know if you’re unknowingly handling all key events deep down in your code. In the past, I’ve noticed that some Corona developers are returning true for all keys received, which would override all keys, including the volume controls.

Thanks,

Brent

The SimpleMixer app exhibits the same behavior.  I have posted a YouTube video of the behavior with the SimpleMixer app running on the device.

Hi @tonygod,

The app shown in your video doesn’t appear to be the original SimpleMixer app that we currently distribute. Did you modify it or something?

Brent

Hi Brent, you are right, the code was from an old build of Corona.  I grabbed the SampleCode from 2014.2511 and rebuilt and am seeing the same behavior.  I will upload a video of the new build, but it is essentially the same result.

I uploaded a second video that shows the SimpleMixer sample from build 2014.2511 running on the Kindle Fire HD 8.9.  I also noted that I found another app that exhibits the behavior, but I suspect it may also be a Corona application.

http://youtu.be/IBgBQsPQLec

Hi @tonygod,

Here’s an update from our side. We tested it on that exact same device and we can’t reproduce the issue, so we think there is something on your device that’s causing it. Perhaps a 3rd-party app that’s hijacking the global volume control. It’s not likely an issue that happens to all Kindle Fire HD 8.9" devices, or else the rest of the Corona community would be raising the same issue. Also, I’m pretty sure Amazon tests volume/mute control when reviewing apps (i.e in the case of “RGB Express” which is a Corona-powered app).

Our best recommendation is to reset your device back to its factory defaults and re-test.

Thanks,

Brent

Hello Brent,

Today I tried resetting the device to factory settings, but am still seeing the same behavior.  I’ve only got Crossy Road (a non-Corona app), one of my Corona apps, and the SimpleMixer sample installed.  

At this point, I cannot think of a reason that this would behave like this just for me.  This is a first-generation Kindle Fire HD 8.9".  Let me know if there’s other data I can pull from the device or other tests I can perform to help understand the issue.

Thanks,

Tony

Hi Tony,

I’m baffled by this as well. We tried the exact same app (SimpleMixer) on the same device, and there were no problems. Is your Kindle fully updated to the latest OS? Are there any firmware updates you can do to it? I don’t have that device in front of me at the moment, so I can’t tinker with it.

Brent

I have 8.5.1_user_5156520, which is the latest available according to Amazon: http://www.amazon.com/gp/help/customer/display.html?nodeId=201177550.

Hi @tonygod,

Just to confirm, in your tests, the hardware buttons do nothing in regards to the volume of the audio playing within Corona? As in, you can turn it down to the lowest volume level, and the song is still playing loudly? That seems very odd and would need to be investigated further…

Thanks,

Brent

Yes, that is what I am observing on my hardware.  I only have the one Kindle Fire HD 8.9 though, so I do not know if it is true of other Kindle devices.

Hi @tonygod,

Can you build and run one of Corona’s sample apps as-is on your Kindle Fire? Our “Media/SimpleMixer” app would be a good choice. We need to know if you’re unknowingly handling all key events deep down in your code. In the past, I’ve noticed that some Corona developers are returning true for all keys received, which would override all keys, including the volume controls.

Thanks,

Brent

The SimpleMixer app exhibits the same behavior.  I have posted a YouTube video of the behavior with the SimpleMixer app running on the device.

Hi @tonygod,

The app shown in your video doesn’t appear to be the original SimpleMixer app that we currently distribute. Did you modify it or something?

Brent

Hi Brent, you are right, the code was from an old build of Corona.  I grabbed the SampleCode from 2014.2511 and rebuilt and am seeing the same behavior.  I will upload a video of the new build, but it is essentially the same result.

I uploaded a second video that shows the SimpleMixer sample from build 2014.2511 running on the Kindle Fire HD 8.9.  I also noted that I found another app that exhibits the behavior, but I suspect it may also be a Corona application.

http://youtu.be/IBgBQsPQLec

Hi @tonygod,

Here’s an update from our side. We tested it on that exact same device and we can’t reproduce the issue, so we think there is something on your device that’s causing it. Perhaps a 3rd-party app that’s hijacking the global volume control. It’s not likely an issue that happens to all Kindle Fire HD 8.9" devices, or else the rest of the Corona community would be raising the same issue. Also, I’m pretty sure Amazon tests volume/mute control when reviewing apps (i.e in the case of “RGB Express” which is a Corona-powered app).

Our best recommendation is to reset your device back to its factory defaults and re-test.

Thanks,

Brent