Reputation: 1
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
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