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

203
Vistas
What to do to store recording stream into the mobile browser using Media Recorder API?

I have a project requirement to record and store the currently running video stream. I have used webRTC for video streaming, and to record the video streaming, I have used MediaRecorder API. It is completely working fine in the desktop system. But it is not working in the mobile browser.

Any idea why it is not working in the mobile browser?

Following is the code snippet:

componentDidMount = async () => {
                recordingStream =  await navigator.mediaDevices.getDisplayMedia({
                  video: true,
                  audio: true,
                });

                const mergedAudio = await this.mergeAudioStreams();
                console.log("audio track length... ", mergedAudio.length);
                const tracks = [
                  ...recordingStream.getVideoTracks(),
                  ...mergedAudio,
                ];

                captureStream = new MediaStream(tracks);
                mediaRecorder = new MediaRecorder(captureStream, options);
                mediaRecorder.ondataavailable = this.handleDataAvailable;
                mediaRecorder.start();
       
}

handleDataAvailable = async event => {
    console.log("data-available", event);
    if (event.data.size > 0) {
      recordedChunks.push(event.data);
      this.download();
    } else {
      // ...
      console.log("in else");
    }
  };
  
 download = async () => {
    console.log("in download fn");
    var blob = await new Blob(recordedChunks, {
      type: "video/mp4",
    });
    
    
    //called the API to store the recorded video
}

mergeAudioStreams = async () => {
console.log("recordScreen fn called");

const ctx = new AudioContext();
const dest = ctx.createMediaStreamDestination();
let localSource, remoteSource;

if (this.state.localStream.getAudioTracks().length > 0) {
  localSource = ctx.createMediaStreamSource(this.state.localStream);
}

if (this.state.selectedVideo.stream.getAudioTracks().length > 0) {
  remoteSource = ctx.createMediaStreamSource(
    this.state.selectedVideo.stream
  );
}

const localGain = ctx.createGain();
const remoteGain = ctx.createGain();

localGain.gain.value = 0.7;
remoteGain.gain.value = 0.7;

localSource.connect(localGain).connect(dest);

remoteSource.connect(remoteGain).connect(dest);

console.log("combine tracks..", dest.stream.getAudioTracks());

return dest.stream.getAudioTracks();
  };

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