title: vlcj - How to change the volume of audio before playing it?
body: <p>I tried this</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>val player: MediaPlayer = MediaPlayerFactory("-vvv").mediaPlayers().newMediaPlayer()
  val result0: Boolean = player.audio().setVolume(50) // result0: true
  player.media().play("/path/to/audio.ogg")
  val result1: Boolean = player.audio().setVolume(50) // result1: false
  </code></pre>
  
  <p>and this</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>val player: MediaPlayer = MediaPlayerFactory("-vvv").mediaPlayers().newMediaPlayer()
  val result0 = player.audio().setVolume(50) // result0: true
  player.media().prepare("/path/to/audio.ogg")
  val result1: Boolean = player.audio().setVolume(50) // result1: false
  player.controls().play()
  val result2: Boolean = player.audio().setVolume(50) // result2: false
  </code></pre>
  
  <p>but the volume remains at 100%.
  The only way I found is to make something like this</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>val player: MediaPlayer = MediaPlayerFactory("-vvv").mediaPlayers().newMediaPlayer()
  player.events().addMediaPlayerEventListener(object : MediaPlayerEventAdapter() {
      override fun mediaPlayerReady(mediaPlayer: MediaPlayer) {
          mediaPlayer.submit {
              mediaPlayer.audio().setVolume(50)
          }
      }
  })
  player.media().play("/path/to/audio.ogg")
  </code></pre>
  
  <p>But the solution is a bit far from ideal. Because it starts to play, plays a bit, and then whoosh, the volume has changed.</p>
  
  <p>I tried vlcj 4.4.0 and 4.5.2, VLC 3.0.8 and 3.0.10, jdk8 and 14, but it works in the same way.</p>