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
Contributor
Posts: 10
Registered: ‎04-17-2010
My Device: Bold 9000
My Carrier: AT&T

Programmatically Controlling Media Volume to Bluetooth Devices

Hi, I've been hunting around for an answer to this problem, and other than giving my computer a virus from an evil link I have come up with nothing.

 

The problem I have is not with the code as such, but I'm going to explain basically what my code does so we're all on the same page.

 

I have a BB application that plays MP3 files via its own player control.  The app is compiled against v4.5 of the BB API.

It uses a standard "javax.microedition.media.Player" obtained by calling "javax.microedition.media.Manager.createPlayer(String locator)".

 

Once the player is created I retrieve its volume control using "getControl(String)" with "javax.microedition.media.control.VolumeControl" which returns me a "net.rim.device.internal.media.AdvancedVolumeControlImpl" instance.  I also retrieve an AudioPathControl by getting the "net.rim.device.api.media.control.AudioPathControl" so I can route where the audio is going.

 

Lastly, I set up myself as a playerlistener so I can see what's going on behind the scenes.

 

 

Now we get to the meat of the matter:

 

If I try to play audio via any non-Bluetooth device (Speaker, Handset, Wired-Headset) all is well - audio plays, volume can be adjusted using 'setVolume(0-100)' on the VolumeControl object.

 

If I use the AudioPathControl to route the audio to a Bluetooth device, the playback also works (kinda), but I notice the following problems:

 

1) I get an event thru the listener of type "com.rim.volume.control.type" with data "volume.control.type.relative"

2) I can't change the volume of playback (which for some users is so low they cannot hear anything!)

 

When the audio is routed back to a non-BT device I get another "com.rim.volume.control.type" but this time with data "volume.control.type.absolute"... and now I can control volume again.

 

So... given that the 'setVolume()' method takes a value from 0-100, and nothing I feed in within that range makes any difference... how do I adjust the volume when playback is via Bluetooth?

 

 

Doug

Contributor
Posts: 10
Registered: ‎04-17-2010
My Device: Bold 9000
My Carrier: AT&T

Re: Programmatically Controlling Media Volume to Bluetooth Devices

No-one has any ideas?

 

If I try to play audio via any non-Bluetooth device (Speaker, Handset, Wired-Headset) all is well - audio plays, volume can be adjusted using 'setVolume(0-100)' on the VolumeControl object.

 

If I use the AudioPathControl to route the audio to a Bluetooth device, the playback also works (kinda), but I notice the following problems:

 

1) I get an event thru the listener of type "com.rim.volume.control.type" with data "volume.control.type.relative"

2) I can't change the volume of playback (which for some users is so low they cannot hear anything!)

 

When the audio is routed back to a non-BT device I get another "com.rim.volume.control.type" but this time with data "volume.control.type.absolute"... and now I can control volume again.

 

So... given that the 'setVolume()' method takes a value from 0-100, and nothing I feed in within that range makes any difference... how do I adjust the volume when playback is via Bluetooth?

Developer
Posts: 48
Registered: ‎06-24-2010
My Device: Storm 2
My Carrier: Orange

Re: Programmatically Controlling Media Volume to Bluetooth Devices

Did you figure it out?

Contributor
Posts: 10
Registered: ‎04-17-2010
My Device: Bold 9000
My Carrier: AT&T

Re: Programmatically Controlling Media Volume to Bluetooth Devices

Nope, yours is the only response Smiley Sad

New Contributor
Posts: 7
Registered: ‎01-18-2010
My Device: Curve 8900
My Carrier: Base (Belgium)

Re: Programmatically Controlling Media Volume to Bluetooth Devices

I d be so interested by an app that would control the media volume since my side buttons are broken...