Android Question Volume for Mediaplayer

FlyingEagle

Member
Licensed User
Longtime User
hi,

it is possible to adjust the level of a mediaplayers (and thus also of the system?) read, signaled my app full volume, and then put back to the old value? or there are other routes a bit noisy play even if the phone is on silent?

expansion of demand on TTS, too.

can you give me tips as to give?

regards
fly
 

FlyingEagle

Member
Licensed User
Longtime User
what i want to do is to play a sound as loud as possible, independant from system-settings.
but i will restore them after it.

Your Link, out of the help:
B4X:
SetVolume (Channel As Int, VolumeIndex As Int, ShowUI As Boolean)
Sets the volume of the specified channel.
Channel - One of the VOLUME constants.
VolumeIndex - The volume index. GetMaxVolume can be used to find the largest possible value.
ShowUI - Whether to show the volume UI windows.
Example:
Dim p As Phone
p.SetVolume(p.VOLUME_MUSIC, 3, True)

there is only GetMaxVolume, but i think i need something like GetActualVolume.
and i need this for my Dim MP as MediaPlayer and for Dim TTS1 as TTS.
 
Upvote 0

Linostar

Member
Licensed User
Longtime User

There IS 'GetVolume' in the same library, which will gives what you need:

B4X:
GetVolume (Channel As Int) As Int
Returns the volume of the specified channel.
Channel - One of the VOLUME constants.

Example:
Dim p As Phone
Dim Music_Vol as Int
Music_Vol = p.GetVolume(p.VOLUME_MUSIC)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…