Safari parseBlob failure
Is there an existing issue for this?
- [X] I have searched the existing issues
music-metadata version
10.2.0
Current Behavior
When parsing a blob with Safari, I get the following error:
TypeError: ReadableStreamBYOBReader needs a ReadableByteStreamController
Expected Behavior
No response
Attached audio sample?
- [X] I have provided sufficient information to reproduce the issue
I've tried using:
https://github.com/MattiasBuelens/web-streams-polyfill
It doesn't work.
Do you have the same issue here using Safari?
A workaround is:
import {parseBuffer} from 'music-metadata';
let blob; // Assume this Blob is assigned
const metadata = await parseBuffer(await blob.bytes()), {mimeType: blob.type});
(I have not tested it)
Ref:
Is there is any news, feel free to re-open
Yes, the issue occurs there as well. The proposed workaround works though, for what its worth.
I will try to switch from BYOB (bring your own buffer)/byte stream to the default stream.
Ref: https://developer.mozilla.org/docs/Web/API/ReadableStream/ReadableStream
@jonluca can please retry here: https://fallback-on-default-reader--audio-tag-analyzer.netlify.app/
Same issue
Do you mind to try one more time @jonluca ? GUI should show v10.8.0-beta.3", otherwise please reload your browser.
New error this time haha
Any improvement in music-metadata 10.8.1 deployed on https://github.com/Borewit/audio-tag-analyzer @jonluca ?
If you experience the same error, can you pinpoint where the out-of-bounds exception occurs?
Same issue
A way to debug might be to use bun -
import { parseBlob } from "music-metadata";
import { promises as fs } from "fs";
const data = await fs.readFile("~/Downloads/bohemian-rhapsody.mp3");
const blob = new Blob(data);
const metadata = await parseBlob(blob);
console.log(metadata);
bun test.mjs
Returns this exception
That was a pretty dumb attempt, as this is the the same TypeError error we had in the beginning.
This TypeError should be caught to fallback on StreamDefaultReader.
You mind to try another time @jonluca, it may very very well now throw the Range out of bounds error. If you can please indicate where that occurs.
I dont believe the site has an updated build - it's the same error as earlier.
However testing with main with bun seems to be working?
I've created a PR that adds a test suite for bun, since it uses JavaScriptCore under the hood, the same engine as Safari. There seems to be a timeout with webstreams in JSC in WavPack but otherwise seems fine.
https://github.com/Borewit/music-metadata/pull/2348
I dont believe the site has an updated build - it's the same error as earlier.
I was convinced I merged the music-metadata v10.8.2, but apparently not. Now it is in via https://github.com/Borewit/audio-tag-analyzer/pull/1116.
Relevant change is: https://github.com/Borewit/peek-readable/pull/794/commits/21b34df5cc3fa14360d08158f5eb6871a9bd4e2b
I've created a PR that adds a test suite for bun, since it uses JavaScriptCore under the hood, the same engine as Safari. There seems to be a timeout with webstreams in JSC in WavPack but otherwise seems fine.
Awesome!
Not sure if you folks are keeping the issue open for a specific reason, but tried the latest version of the library and Audio Tag Analyzer now and it works wonderfully!
Not sure if you folks are keeping the issue open for a specific reason, but tried the latest version of the library and Audio Tag Analyzer now and it works wonderfully!
Thanks for letting me know @sleepyfran, I did not know, and I am glad to hear it, as I spend many hours resolving this issue by implementing a dual Reader both, support BYOB and default, deep down in the dependency tree. But unable to test it myself with Safari.