How can I make the device's volume turn up/down Smoothly

A little hard for me to explain the problem.

When I try to to turnup/down the volum by using the physical volume buttons of my device it works but if I try to set the volume to level 0 from level 10 (for example) by a long press of the physical volume buttons of my device it doesn’t work. it just go from 10 to 9 and I need to press tham again and again 10 times. why cant I just use a long press/hold the button?

Is your code listening for and handling volume key presses? Or are you relying on the default behavior? I was having trouble w/ the defaults so I now handle the buttons myself. 

However I’m not sure if the buttons have event phases other than “down” – if they have a phase like “up” then you should be able to detect when the button is still in the down position, and gradually change the volume until they release it.

Im relying on the default behavior

I don’t know about on Android but on iOS users expect that each volume up or down is 10% increase. Even the Apple built apps jump in 10% increments. If you care about user experience, you probably shouldn’t deviate from the OS’s base behavior.

That said, I hate the 10% increments personally. I’m always wanting to get a volume in between.  I find a 4 to be too low and a 5 to be too high at times.

If you want to control your apps volume, you need to catch the key events and change the master channel volume in whatever increments you want. 10% is 10 key presses to go from off to full. 5% is 20 key presses 1% is 100 keypresses. Keep that in mind to for your user experience. We only generate one event while the key is pressed and one when it’s released.

Rob

No THat is not what I meant. If I hold the volume button It cant turndown  from 10 to 0 like in every app it goes just one level.

Corona events fire once per key press and release. If you press down volume you get one volumeDown event with a phase of “down” and then when you let up you get another event with a phase of “up”.  If you want it to work while the key is held, then you’re going to need to implement something similar to this tutorial:

https://coronalabs.com/blog/2014/02/04/tutorial-continuous-actions-in-corona/

Rob

Is your code listening for and handling volume key presses? Or are you relying on the default behavior? I was having trouble w/ the defaults so I now handle the buttons myself. 

However I’m not sure if the buttons have event phases other than “down” – if they have a phase like “up” then you should be able to detect when the button is still in the down position, and gradually change the volume until they release it.

Im relying on the default behavior

I don’t know about on Android but on iOS users expect that each volume up or down is 10% increase. Even the Apple built apps jump in 10% increments. If you care about user experience, you probably shouldn’t deviate from the OS’s base behavior.

That said, I hate the 10% increments personally. I’m always wanting to get a volume in between.  I find a 4 to be too low and a 5 to be too high at times.

If you want to control your apps volume, you need to catch the key events and change the master channel volume in whatever increments you want. 10% is 10 key presses to go from off to full. 5% is 20 key presses 1% is 100 keypresses. Keep that in mind to for your user experience. We only generate one event while the key is pressed and one when it’s released.

Rob

No THat is not what I meant. If I hold the volume button It cant turndown  from 10 to 0 like in every app it goes just one level.

Corona events fire once per key press and release. If you press down volume you get one volumeDown event with a phase of “down” and then when you let up you get another event with a phase of “up”.  If you want it to work while the key is held, then you’re going to need to implement something similar to this tutorial:

https://coronalabs.com/blog/2014/02/04/tutorial-continuous-actions-in-corona/

Rob