Reputation: 3750
I'm chunking a WebM to load via Media Source Extensions.
const SEGMENT = 3
const chunks = Math.floor(duration/SEGMENT)
const chunk = Math.ceil(Math.max(1000000,size)/chunks)
if(chunks === 1 || size < 1000000)
return [{from: 0, to: size}]
return [...Array(chunks -1).keys()].reduce((prev, next, index) => {
if(index < chunks-2)
return [...prev, {from: prev[index].to + 1, to: prev[index].to + chunk }]
else
return [...prev, {from: prev[index].to + 1, to: size}]
}, [{from: 0, to: chunk}])
This works 95% of the time, however, I've got some cases where the video fails to start with the error:
I'm assuming the important information isn't in the first MB as I've coded here.
What is the minimum chunk size so the video will play?
Upvotes: 0
Views: 308