Arul Harsh
Arul Harsh

Reputation: 1

ExoPlayer set volume is not working for simple exo player

new Handler().postDelayed(new Runnable() { @Override public void run() { if (exoPlayer != null) { exoPlayer.setVolume(0); // Mute the player } } 500); // 100 milliseconds delay

i am doing this to mute the exoplayer but its nto working my exoplayer version is

implementation 'com.google.android.exoplayer:exoplayer:r2.4.0'

i cant upgrade to latest version because i have to upgrade the whole project which is nto possible at the moment

Upvotes: 0

Views: 382

Answers (1)

Shivansh Singh
Shivansh Singh

Reputation: 16

To control the volume with ExoPlayer, just use this :

AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audioManager.setStreamVolume(exoPlayer.getAudioStreamType(), setVolume, 0);

replace setVolume with your desired volume.

Upvotes: 0

Related Questions