how to set the volume of Media Player

All your problems with Audio, Video and Images.

how to set the volume of Media Player

Postby drik_wen » Fri Aug 01, 2008 3:56 am

I want to add two more button to my music player to set the volume up and down..
but I don't know to do it..
is there somebody can help me??
or give me a sample code..
thx in advanced
drik_wen
Freshman
Freshman
 
Posts: 6
Joined: Sat Jul 12, 2008 3:00 am

Top

Postby Michael T » Sun Sep 28, 2008 4:55 am

MediaPlayer has a method for this:

http://code.google.com/android/referenc ... t,%20float)
Michael T
Freshman
Freshman
 
Posts: 2
Joined: Thu Sep 25, 2008 2:14 am

Postby kenjkelly » Mon Oct 06, 2008 3:52 am

Maybe I'm missing something but, wouldn't it be great if whoever wrote the docs took a few more seconds to put the range of values for rightvolume and left volume. I find this kind of ommision throughout the docs frustrating.

public void setVolume(float leftVolume, float rightVolume) They specify them as "raw scalar" .
Is it the range of 0-1? or 0-max size of a float? or 0-100? 1-10?

So the question is: What is the range of volume values allowed for MediaPlayer.setVolume(float leftVolume, float rightVolume) ?
kenjkelly
kenjkelly
Freshman
Freshman
 
Posts: 7
Joined: Mon Oct 06, 2008 3:30 am

Re: how to set the volume of Media Player

Postby splunchy » Sat Jun 04, 2011 2:42 pm

It is 0...1 !

But no idea how to scale it correctly!
splunchy
Freshman
Freshman
 
Posts: 4
Joined: Wed Oct 27, 2010 10:19 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 16 guests