Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda