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

198
Views
Angular Subir audio grabado en angular a firebase storgae

Estoy trabajando en un proyecto en el que necesito grabar audio y permitir que el usuario se detenga cuando termine de grabar. Quiero subir este audio grabado al almacenamiento de Firebase. No estoy seguro de cómo hacerlo.

Estoy compartiendo el enlace de stack blitz donde he implementado la funcionalidad de la grabadora de audio.

https://stackblitz.com/edit/angular-record-rtc-demo

He creado una función de descarga como la siguiente

 _downloadFile(data: any, type: string, filename: string): any { const blob = new Blob([data], { type: type }); const url = window.URL.createObjectURL(blob); //this.video.srcObject = stream; //const url = data; const anchor = document.createElement('a'); anchor.download = filename; anchor.href = url; document.body.appendChild(anchor); anchor.click(); document.body.removeChild(anchor); }

He creado la función para cargar un archivo como el siguiente

 selectFile(event): void { this.isUploading = true this.percentage = 0 const file = event.target.files[0]; this.currentFileUpload = new FileUpload(file); const filePath = `voice`; const fileRef = this.storage.ref(filePath); const task = this.storage.upload(`voice`, file); task .snapshotChanges() .pipe( finalize(() => { this.downloadURL = fileRef.getDownloadURL(); this.downloadURL.subscribe(url => { console.log(url) if (url) { this.isUploading = false this.fb = url; } this.addUrlToEditor(url) task.percentageChanges().subscribe(percentage => { this.percentage = Math.round(percentage); this.percentage = percentage }) }); }) ) .subscribe(url => { if (url) { this.selectedFiles = null; } }); }

Puedo descargar el audio. Pero también quiero cargar el audio grabado en el almacenamiento de Firebase y usar esa URL como referencia futura para descargar el audio y otras cosas. Cualquier ayuda será apreciada.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar this.audioName y this.audioBlob :

 const storage = getStorage(); // imported from firebase/storage const storageRef:any = ref(storage, this.audioName); uploadBytes(storageRef, this.audioBlob);

Esta solución asume que ya configuró Firebase en su Proyecto Angular.

about 4 years ago · Juan Pablo Isaza Report
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!