title: reactjs change currentTime of audio while playing
body: <p>I have this audio player and I need to be able to change the currentTime while the audio file is playing. Currently I can change the currentTime only when audio is paused. What should I change in my code?</p>
  
  <pre><code>playAudio(playing_url) {
      let audio = new Audio(playing_url);
      audio.addEventListener('loadedmetadata', () =&gt; {
          audio.currentTime = audio.duration * this.state.progress;
          console.log('event listener', audio.duration);
      });
      if(!this.state.playing) {
          audio.play();
          this.setState({
              playing: true,
              playing_story: playing_url,
              audio
          });
      } else {
          if(this.state.playing_story === playing_url) {
              this.state.audio.pause();
              this.setState({
                  playing: false
              })
          } else {
              this.state.audio.pause();
              audio.play();
              this.setState({
                  playing: true,
                  playing_story: playing_url,
                  audio
              })
          }
      }
  
  }
  </code></pre>