Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
geHuC
Posts: 23
Registered: ‎03-22-2011
My Device: Not Specified
Accepted Solution

Control device audio volume?

Any idea how it's done ?

as far as i figured i have to import the audiomanager class from the qnx system and then call the setOutputLevel function passing in the nuber i want it to be but it doesn't seem to work :smileyfrustrated:

PS: i'm running 10.0.9.388 soft on my DevAlpha and compiling using the 3.0.0 SDK

Please use plain text.
BlackBerry Development Advisor (Retired)
grahamzibar
Posts: 71
Registered: ‎09-19-2012
My Device: No sleep til BlackBerry 10
My Carrier: Bell

Re: Control device audio volume?

Howdy!

 

import the following:

 

import qnx.system.AudioManager;

import qnx.system.AudioOutput;

 

in your desired code block add:

 

AudioManager.audioManager.setOutputLevel(0.1, AudioOutput.SPEAKERS);

 

The second argument can be null and it will set whatever output is currently being used, but I like to be explicit!  Next, add the following to your bar-descriptor.xml:

 

<permission>set_audio_volume</permission>

 

I hope that helps!  Let me know how this works for you.

 

Cheers!

-grahamzibar

------------------------------
@grahamzibar
-_- zZZ
Please use plain text.
Contributor
geHuC
Posts: 23
Registered: ‎03-22-2011
My Device: Not Specified

Re: Control device audio volume?

Thx man, setting them permissions did the trick :Clap: Though the value that worked was from 0 to 100, not 0 to 1 like it says in the reference :Beta1:

Please use plain text.
BlackBerry Development Advisor (Retired)
grahamzibar
Posts: 71
Registered: ‎09-19-2012
My Device: No sleep til BlackBerry 10
My Carrier: Bell

Re: Control device audio volume?

Nice!  Yeah, when I set it to 0.1 it certainly did look A LOT LESS than 10% :smileytongue:

 

I'll check with the AIR SDK team to see which will be the final implementation.  For consistency with ActionScript I imagine it will eventually be 0 to 1 as opposed to 0 to 100, so be sure to be prepared for that.

 

Glad I could help!

-grahamzibar

------------------------------
@grahamzibar
-_- zZZ
Please use plain text.
Developer
UberschallSamsara
Posts: 922
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Control device audio volume?

[ Edited ]

<post deleted>

Sorry, posting a new thread since this was marked solved.

 

Please use plain text.