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

197
Views
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 answers
Answer question

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 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!