Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

271
Vistas
i have tried to pause video in html when user switch browser tab and when come back on that tab video play again automatically from where it stopped

this is script of simple video tag that I use in my html document

var video = document.getElementById('video'); var documentTitle = document.title; var updateTitleForVideo = function(state) { if(state === 'visible') { document.title=documentTitle; return; } document.title = documentTitle + ' ['+ state +']'; }; video.onpause = function() { updateTitleForVideo('Paused'); }; video.onplay = function() { updateTitleForVideo('Played'); }; document.addEventListener('visibilitychange' , function(){ var state = document.visibilityState; if(!video.paused){ if(state === 'hidden'){ video.pause(); updateTitleForVideo('Paused'); } } if(!video.played){ if(state === 'visible'){ video.play(); updateTitleForVideo('Played'); } } });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

const video  = document.getElementById("video")
//The rest of your code
// video.onpause etc...

window.addEventListener("blur", function() {
video.pause();
})

window.addEventListener("focus", function(){
video.play();
})

more information

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda