07-16-2008 01:27 PM - last edited on 07-16-2008 01:33 PM
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?
Solved! Go to Solution.
07-16-2008 02:49 PM
07-16-2008 02:58 PM
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!
07-16-2008 03:04 PM
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.
07-17-2008 12:49 PM
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.AudioPathCont
rolImpl@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.MetaDataCon
trolImpl@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.
07-17-2008 01:10 PM - last edited on 07-17-2008 01:15 PM
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");
07-17-2008 01:16 PM
07-17-2008 01:58 PM
07-18-2008 08:08 AM
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?
07-21-2008 10:53 AM
The solution provided by javec and using net.rim.device.api.system.Alert.setVolume() finally worked. Thanks a lot!