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

199
Vistas
initial blob is playing, from second blob is not playing
componentDidMount() {
        navigator.mediaDevices
            .getUserMedia({ video: true})
            .then(stream => { this.handleSuccess(this.videoTag.current.srcObject = stream) })
            .catch(console.log);

    }


handleSuccess(stream) {
        console.log('st',stream)
        media_recorder = new MediaRecorder(stream);
            media_recorder.start(10000);
            media_recorder.addEventListener('dataavailable', function (e) {
                console.log('e.data', e.data)
                var reader = new FileReader();
                var base64data
                reader.readAsDataURL(e.data);
                reader.onload = function () {
                    base64data = reader.result;
                    const base64EncodedData = base64data.split(',')[1];
                    const body = JSON.stringify({
                        data: base64EncodedData
                    });
                    fetch('http://localhost:3090/api/recording', {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json',
                            'Accept': 'application/json'
                        },
                        body
                    }).then(res => {
                        return res.json()
                    }).then(json => console.log(json));                    
                }
            });
}

from the webcam i am continuously generating blob at regular intervals then i am encoding to base64 and decoding at server level which helps me to generate mp4 files in local storage but the issue was when i started the playing those generated files only initial file is playing, from second file onward it is not playing can any one help to solve this issue

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Unfortunately this is how the MediaRecorder works. The chunks emitted by the dataavailable events are not necessarily self contained. It's only guaranteed that they make sense when combined again.

I think in your case the initial part is playing since it looks like a complete file to the decoder. All consecutive parts probably miss any header (since they are meant to get appended to the first part) and therefore don't get recognized by the decoder.

Maybe you have the chance to decode the full recording in chunks again instead of decoding the individual parts.

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