-
-
Save parzibyte/c37a433f531f45af36d7f0cd95d0fd25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cuando se detenga (haciendo click en el botón) se ejecuta esto | |
mediaRecorder.addEventListener("stop", () => { | |
// Detener el stream | |
stream.getTracks().forEach(track => track.stop()); | |
// Detener la cuenta regresiva | |
detenerConteo(); | |
// Convertir los fragmentos a un objeto binario | |
const blobAudio = new Blob(fragmentosDeAudio); | |
// Crear una URL o enlace para descargar | |
const urlParaDescargar = URL.createObjectURL(blobAudio); | |
// Crear un elemento <a> invisible para descargar el audio | |
let a = document.createElement("a"); | |
document.body.appendChild(a); | |
a.style = "display: none"; | |
a.href = urlParaDescargar; | |
a.download = "grabacion_parzibyte.me.webm"; | |
// Hacer click en el enlace | |
a.click(); | |
// Y remover el objeto | |
window.URL.revokeObjectURL(urlParaDescargar); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment