Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda