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

Java Development

Reply
New Developer
Posts: 8
Registered: ‎07-16-2008
My Device: Not Specified
Accepted Solution

Unable to set audio volume on BlackBerry Pearl 8130

[ Edited ]

Hello

 

First of all the necessary information about the device and JDE:

 


Device: BlackBerry Pearl 8130 (Bell)

F/W: 4.3.0.66 (Platform 3.1.0.35)

JDE: 4.3.0.1r


 

Our application reacts on the key input events of the volume keys and sets the audio volume accordingly in increments of 10. While net.rim.device.api.system.Audio.getVolume() works fine and returns the correct value we are unable to set the volume. Setting is done via setVolume(int volume) of net.rim.device.api.system.Audio. The method call seems to be successful because there is no error returned. If we call setVolume(90) after getVolume() returned 100 the next call of getVolume() returns 90. However there is no noticeable change in volume. Even if getVolume() returns 0 audio is still heard.

 

Playing of media files is done via MMAPI, i.e. javax.microedition.media.Manager and javax.microedition.media.Player.

 

Please note that setting of volume works fine for BB Pearl 8100 with firmware version v4.2.1.101 (Platform 2.3.0.80) but fails for the device above. Application is signed.

 

How is it possible to set the audio volume on BB Pearl 8130?

Message Edited by frank79 on 07-16-2008 01:33 PM
Developer
Posts: 16
Registered: ‎07-14-2008
My Device: 8310

Re: Unable to set audio volume on BlackBerry Pearl 8130

If you're using mmapi why aren't you using that to set the volume? you should be using the VolumeControl interface of your Player instance 
Developer
Posts: 445
Registered: ‎07-15-2008
My Device: Not Specified

Re: Unable to set audio volume on BlackBerry Pearl 8130

CDMA devices (xx30) do not correctly set the volume if you use the setVolume(int i) function.

 

net.rim.device.api.system.Alert.setVolume(int x) also exists.

Maybe that works! 

 

 

If your question was answered, please accept it as a sollution and / or give Kudos ;-)
______________________________
Use the Search Field first! Maybe the question you want to ask already exists!
Retired
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: Unable to set audio volume on BlackBerry Pearl 8130

The Audio class sets global audio volumes for the device and will be subject to contention with other applications that modify these settings. 

 

For controlling the volume within your own application, as jhfisher indicated, VolumeControl is best practice. 

Brian Zubert
Technical Partnership Manager
Research In Motion
New Developer
Posts: 8
Registered: ‎07-16-2008
My Device: Not Specified

Re: Unable to set audio volume on BlackBerry Pearl 8130

Hello.

 

Thank you guys for your quick response. Actually setting the volume via net.rim.device.api.system.Audio.setVolume() is already a fallback if setting via VolumeControl fails. Actually there is no VolumeControl on both devices.

 

See the code below:

Control[] controls = player.getControls();
for(int i = controls.length -1; i >= 0; i--) {
System.out.println("Control: " + controls[i]);
}

 

Results for BB Pearl 8100 where setting of volume is done via Audio.setVolume():

 

Control: net.rim.device.internal.media.router.AudioPathControlImpl@f8b7d236
Control: net.rim.device.internal.media.metadata.MetaDataControlImpl@6cb7441d
Control: net.rim.device.internal.media.StreamingMediaPlayer@bd00e9d4

 

Results for BB Pearl 8130 (Bell):

 

Control: net.rim.device.internal.media.metadata.MetaDataControlImpl@36b93302
Control: net.rim.device.internal.media.StreamingMediaPlayer@1577cdf7

 

So as you see there is no VolumeControl for both devices. The file has been either a MP3 or a MP4, Player has been either in state STARTED or PREFETCHED and has been created by Manager.createPlayer(fileURI).

 

Do you have any more hints on this issue? Are you able to access VolumeControl and adjust the volume?

 

Thank you.


 

Developer
Posts: 16
Registered: ‎07-14-2008
My Device: 8310

Re: Unable to set audio volume on BlackBerry Pearl 8130

[ Edited ]

VolumeControl works fine across all models here, 8700 and onwards using similar to:

 

 

FileConnection fc = (FileConnection) Connector.open(path_to_track); InputStream is = fc.openInputStream();

 

 

Player player = javax.microedition.media.Manager.createPlayer(is, "audio/mpeg");

player.realize();

player.prefetch();

VolumeControl vc = (VolumeControl) player.getControl("VolumeControl");

 

 

 

Message Edited by jhfisher on 07-17-2008 01:15 PM
Message Edited by jhfisher on 07-17-2008 01:15 PM
Developer
Posts: 16
Registered: ‎07-14-2008
My Device: 8310

Re: Unable to set audio volume on BlackBerry Pearl 8130

my only guess is it's something to do with not passing the mime type when creating your Player instance.
Developer
Posts: 16
Registered: ‎07-14-2008
My Device: 8310

Re: Unable to set audio volume on BlackBerry Pearl 8130

okay, did a little research, the controls array is returned by the Controllable interface, they're not defined in Player - so if you don't pass a mime-type you wont get the type-specific controls, i'm guessing the rim mmapi implementation handles volume differently for various types and so you're not getting VolumeControl returned.
New Developer
Posts: 8
Registered: ‎07-16-2008
My Device: Not Specified

Re: Unable to set audio volume on BlackBerry Pearl 8130

Thank you a lot for this suggestion but using an InputStream didn't return the VolumeControl as well. For a mp3 with codec audio/mpeg as well as a mp4 with codec audio/mp4.

 

I am stuck currently.

 

Can anyone confirm an existing VolumeControl on any BlackBerry Pearl device?

New Developer
Posts: 8
Registered: ‎07-16-2008
My Device: Not Specified

Re: Unable to set audio volume on BlackBerry Pearl 8130

The solution provided by javec and using net.rim.device.api.system.Alert.setVolume() finally worked. Thanks a lot!