vlc-example-streamplayer icon indicating copy to clipboard operation
vlc-example-streamplayer copied to clipboard

mute/unmute audio

Open royherma opened this issue 7 years ago • 2 comments

Is there a way to toggle audio level (mute/unmute) while its playing?

Thanks!

royherma avatar Jan 07 '19 10:01 royherma

Try modify this class: https://github.com/pedroSG94/vlc-example-streamplayer/blob/master/pedrovlc/src/main/java/com/pedro/vlc/VlcVideoLibrary.java

I think the range is 0-100. Example (not tested):

  public void mute() {
    if (player != null && player.isPlaying()) {
      player.setVolume(0);
    }
  }

pedroSG94 avatar Jan 08 '19 15:01 pedroSG94

Works for me when called from onComplete(). Thanks!

  @Override
  public void onComplete() {
    vlcVideoLibrary.mute();
    Log.d(TAG, "Muting audio");
    Toast.makeText(this, "Playing", Toast.LENGTH_SHORT).show();
  }

smartyw avatar Apr 21 '21 15:04 smartyw