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

329
Vistas
Grabación de audio angular en el navegador

Encontré un ejemplo de cómo configurar una aplicación angular para grabar audio aquí: https://medium.com/@coolchoudharyvijay/use-mic-in-angular-to-record-audio-simplified-1374d89718d3

funciona de maravilla localmente, pero cuando lo construyo y lo coloco en un servidor, aparece este error: ERROR TypeError: no se pueden leer las propiedades de undefined (leyendo 'getUserMedia') y ERROR TypeError: no se pueden leer las propiedades de undefined (leyendo 'stop ')

¿Alguna idea de por qué funcionaría localmente pero no en un servidor?

aquí está el código de script de tipo (que también se puede encontrar en el enlace del artículo anterior):

 import { Component } from '@angular/core'; declare var $: any; import * as RecordRTC from 'recordrtc'; import { DomSanitizer } from '@angular/platform-browser'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { title = 'micRecorder'; //Lets declare Record OBJ record; //Will use this flag for toggeling recording recording = false; //URL of Blob url; error; constructor(private domSanitizer: DomSanitizer) {} sanitize(url: string) { return this.domSanitizer.bypassSecurityTrustUrl(url); } /** * Start recording. */ initiateRecording() { this.recording = true; let mediaConstraints = { video: false, audio: true }; navigator.mediaDevices.getUserMedia(mediaConstraints).then(this.successCallback.bind(this), this.errorCallback.bind(this)); } /** * Will be called automatically. */ successCallback(stream) { var options = { mimeType: "audio/wav", numberOfAudioChannels: 1, sampleRate: 16000, }; //Start Actuall Recording var StereoAudioRecorder = RecordRTC.StereoAudioRecorder; this.record = new StereoAudioRecorder(stream, options); this.record.record(); } /** * Stop recording. */ stopRecording() { this.recording = false; this.record.stop(this.processRecording.bind(this)); } /** * processRecording Do what ever you want with blob * @param {any} blob Blog */ processRecording(blob) { this.url = URL.createObjectURL(blob); console.log("blob", blob); console.log("url", this.url); } /** * Process Error. */ errorCallback(error) { this.error = 'Can not play audio in your browser'; } ngOnInit() {} }
about 4 years ago · Juan Pablo Isaza
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