-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue parsing Matroska files using browser Web Streams #2145
Comments
I think it caused by Borewit/peek-readable#724 |
|
Thanks for testing @hvianna . The only way I have tested web streams is via Blob.toStream(). How do you turn that file into a Web Stream and get to the error? |
I'm using JS-native You can use the simple HTML file below to test it. No need for webpack, just serve it via a local webserver for fetch to work. <!DOCTYPE html>
<html>
<body>
<script type="module">
import { parseWebStream } from 'https://cdn.skypack.dev/music-metadata?min';
fetch('test.mkv')
.then( response => parseWebStream( response.body, response.headers.get('content-type'), { skipPostHeaders: true } ) )
.then( metadata => console.log( metadata ) );
</script>
</body>
</html> This is working fine for mp4 and flac files, but throws that error for mkv. |
Workaround for the issue you experience is, to parse the content-length to the parser. import { parseWebStream } from 'music-metadata';
async function parseMetadata(url) {
console.info('Fetching ' + url);
const response = await fetch(url);
const contentType = response.headers.get('Content-Type');
const contentLength = response.headers.get('Content-Length');
console.info('Content-type = ' + contentType);
const metadata = await parseWebStream(response.body, {mimeType: contentType, size: contentLength ? parseInt(contentLength) : undefined});
console.info('Got metadata');
console.info(metadata);
}
parseMetadata('../sample/5.1 Surround Test (AAC).mkv').catch(error => {
console.error(error);
}); |
Should be fixed in v9.0.3 |
I am getting errors for
.webm
and.mkv
.using
parseWebStream()
:using
parseBlob()
:Originally posted by @hvianna in #2135 (comment)
Yes, same error. I tried with a few video formats (webm, mkv, mp4)..
Fileinfo of one of them:
The text was updated successfully, but these errors were encountered: