Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
How to save the current time of the audio when it is played

I wanted to play the audio from a specific time whenever the user plays the audio, So, I wanted to save the current time of play while the audio is being played.

I have the HTML set up in this way.

<audio id="track" src="/api/streamer/stream"
       ontimeupdate="document.getElementById('tracktime').innerHTML = Math.floor(this.currentTime) + ' / ' + Math.floor(this.duration);">
    <p>Your browser does not support the audio element</p>
</audio>
<span id="tracktime">0 / 0</span>

I can set the current time of the audio as:

var audioElement = document.getElementById('track');
audioElement.currentTime = 226; 

My question is in what event would it be efficient to save the current time of the audio? One possible event would be when the user pauses the audio.

I wanted to save that time and update the database and wanted to start from the same time when users open the audio on multiple devices or browsers.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!