Skip to content

OpenSL ES and MediaPlayer.getVolume() always returns 0 though sound is available

I use OpenSL ES to avoid audio gaps with AudioTrack after pause/play

options.add("--aout=opensles");
...
mediaPlayer.setAudioOutput("opensles");

but mediaPlayer.volume always returns 0, though sound works, I can hear

I can set mediaPlayer.volume = 50, mediaPlayer.volume = 100 but get volume method after this will still return 0

When opensles is not set than get volume method works ok, returns for example 100 and so on

Edited by anonym24