when this parameter is changed, it becomes equal to 0 and playback starts from zero .. Here is the HTML code:

 <div class="audio-timeline"> <div class="audio-current-timeline"></div> <span class="song_path" style="display:none">media/audio/Noize MC - МоС ΠœΠΎΡ€Π΅.mp3/</span> </div> <div class="audio-elements"> <div class="audio-element play"><div class="audio-on"></div></div> <div class="audio-element stop"><div class="audio-stop"></div></div> </div> 

Here is the js code:

 var timeLine = document.getElementsByClassName('audio-timeline')[0]; //отслСдим, ΠΊΡƒΠ΄Π° Π±Ρ‹Π» сдСлан ΠΊΠ»ΠΈΠΊ ΠΏΠΎ Π²Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΉ Π»ΠΈΠ½ΠΈΠΈ для быстрой ΠΏΠ΅Ρ€Π΅ΠΌΠΎΡ‚ΠΊΠΈ timeLine.addEventListener("click", function () { var width = timeLine.offsetWidth; console.log((100/width)*event.clientX); width = (100/width)*event.clientX; audioWidth = audio.duration * width / 100; console.log('audioWidth - ' + audioWidth); audio.currentTime = audioWidth; currentTimeLine.style.width = width + '%'; }, false); 

I tried to simply disable the js file and work with currentTime via the console, it still causes any audio recording restart for any change.

    2 answers 2

    Depending on the task, there may be 2 options:


    • change in the process of downloading the file. The browser uses byte-range requests to get the media file from a certain position. Accordingly, the server must be configured to process them. See the article at the link above.

      Found a pattern. This problem appears only when working with PhpStorm. Without using it, the scripts work stably