Open alssdllc opened 4 months ago
I think that's an issue you'll have to dive into yourself because busboy
can only give you what was given to it. It doesn't modify content types or anything like that. The most important thing to ensure is that you're giving busboy
multipart/form-data data and not video data directly.
You are correct that the content-type is not modified. But isn't the content-type used to determine the mime type?
When I look through some of the code. I am comparing the safari run and the chrome run.
They both hit this code (in multipart.js):
if (header['content-type']) {
const conType = parseContentType(header['content-type'][0]);
if (conType) {
partType = `${conType.type}/${conType.subtype}`;
if (conType.params && typeof conType.params.charset === 'string')
partCharset = conType.params.charset.toLowerCase();
}
}
For safari header['content-type'][0]
is equal to video/mp4
For chrome header['content-type'][0]
is equal to video/mp4;codecs=avc1,opus
For safari conType
is a proper object:
params = {}
subtype = 'mp4'
type = 'video'
For chrome conType
is undefined
.
I would imagine that is part of the problem.
Well, how nice, Chrome gives more, it is not missing or wrong.
I'm still trying to understand how all of this works. The issue is I record a video with MediaRecorder in the browser and submit it to my node server which uses multer (which uses busboy).
In chrome the content-type is: video/mp4;codecs=avc1,opus even when I specify video/mp4. In safari the content-type is video/mp4.
busboy returns the proper mimetype for safari but returns text/plain for chrome. The safari made video is saved properly and plays. The chrome made video does not play properly. I'm assuming it's corrupt or something.