Android Question Why the MediaPlayer vuolume is always high?

CyclopDroid

Well-Known Member
Licensed User
Longtime User
Although I set volume to a minimum on my Haier W910 smaphone the volume always feels high. :eek:
I write:


B4X:
Dim Musica as MediaPlayer
musica.Initialize2("musica")
musica.Load(File.DirAssets,"Musica.mp3")
musica.Looping=True

musica.SetVolume(0.2,0.2)
    If Main.NoSound=False Then musica.Play


...if I change the value into SetVolume (1,1 or 0.1,0.1, etc), nothing change, and the sound play at the same height.
Why? How do you wrong?
Thanks
 

CyclopDroid

Well-Known Member
Licensed User
Longtime User
Thanks Erel,
I already use the Phone.SetVolume using the keys + and -:

B4X:
Sub Activity_KeyPress(KeyCode As Int) As Boolean
Dim temp As Int
'Intercetta il volume e lo regola
  Select KeyCode
  Case KeyCodes.KEYCODE_VOLUME_DOWN
  temp = Main.Phone1.GetVolume(Main.Phone1.VOLUME_MUSIC)
  If temp > 0 Then temp = temp - 1 Else temp = 0
  Main.Phone1.SetVolume(Main.Phone1.VOLUME_MUSIC, temp, True)
  Return True
  Case KeyCodes.KEYCODE_VOLUME_UP
  temp = Main.Phone1.GetVolume(Main.Phone1.VOLUME_MUSIC)
  If temp < Main.Phone1.GetMaxVolume(Main.Phone1.VOLUME_MUSIC) Then
  temp = temp + 1
  Else
  temp = Main.Phone1.GetMaxVolume(Main.Phone1.VOLUME_MUSIC)
  End If  
  Main.Phone1.SetVolume(Main.Phone1.VOLUME_MUSIC, temp, True)
  Return True
   End Select
   End If

Return True
End Sub


but I've three MediaPlayer sound (two special effect and one music sound background).

If I change the Phone.SetVolume, I do not lower all the volumes at the same time?
 
Upvote 0

CyclopDroid

Well-Known Member
Licensed User
Longtime User
Thaks Erel, but the SoundPool not working propelly. Into emulator, the MediaPlayer, it's Ok... only in my Smartphone have a problem :eek:
I think to continue at use MediaPlayer and, when my game is complete, I want to test from other SmartPhone.
 
Upvote 0
Top