gpac / mp4box.js

JavaScript version of GPAC's MP4Box tool
https://gpac.github.io/mp4box.js/
BSD 3-Clause "New" or "Revised" License
1.94k stars 328 forks source link

sample.number = trak.samples.length; ^ TypeError: Cannot read property 'length' of undefined #218

Closed adminy closed 3 years ago

adminy commented 3 years ago
                                    sample.number = trak.samples.length;
                                                                 ^

TypeError: Cannot read property 'length' of undefined
    at ISOFile.updateSampleLists (...node_modules/mp4box/dist/mp4box.all.js:7270:45)
    at ISOFile.appendBuffer (.../node_modules/mp4box/dist/mp4box.all.js:6093:8)
    at .../mp4.js:143:20
    at fillSlowly (.../parser.js:7:5)
    at Timeout._onTimeout (.../parser.js:8:22)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)

It's complaining from within the library. Latest version of mp4box.

What I'm doing is simply:

let dataStreamIndex = 0
const fillData = dataStream => {
        dataStream.fileStart = dataStreamIndex
        dataStreamIndex += dataStream.byteLength
        mp4boxfile.appendBuffer(dataStream)
        mp4boxfile.flush()
    }
// And the downloader calls fillData(buffer) when it gets chunks
cconcolato commented 3 years ago

I made a recent change to the code that fixes some issues. Maybe it fixes yours. Can you try again? Reopen this issue if it does not work and try to provide an example file.