Skip to content
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

Safari parseBlob failure #2221

Open
2 tasks done
bradleat opened this issue Aug 20, 2024 · 14 comments
Open
2 tasks done

Safari parseBlob failure #2221

bradleat opened this issue Aug 20, 2024 · 14 comments
Labels
bug Bug, will addressed with high priority

Comments

@bradleat
Copy link

Is there an existing issue for this?

  • 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?

  • I have provided sufficient information to reproduce the issue
@bradleat bradleat added the bug Bug, will addressed with high priority label Aug 20, 2024
@bradleat
Copy link
Author

I've tried using:

https://github.com/MattiasBuelens/web-streams-polyfill

It doesn't work.

@Borewit
Copy link
Owner

Borewit commented Aug 20, 2024

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:

@Borewit
Copy link
Owner

Borewit commented Sep 3, 2024

Is there is any news, feel free to re-open

@Borewit Borewit closed this as completed Sep 3, 2024
@jonluca
Copy link

jonluca commented Jan 18, 2025

Image

Yes, the issue occurs there as well. The proposed workaround works though, for what its worth.

@Borewit
Copy link
Owner

Borewit commented Jan 18, 2025

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

@Borewit
Copy link
Owner

Borewit commented Jan 18, 2025

@jonluca
Copy link

jonluca commented Jan 19, 2025

Image

Same issue

@Borewit
Copy link
Owner

Borewit commented Jan 19, 2025

Do you mind to try one more time @jonluca ? GUI should show v10.8.0-beta.3", otherwise please reload your browser.

@jonluca
Copy link

jonluca commented Jan 19, 2025

Image

New error this time haha

Im-Beast added a commit to Im-Beast/music-player that referenced this issue Jan 27, 2025
@Borewit
Copy link
Owner

Borewit commented Jan 30, 2025

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?

@jonluca
Copy link

jonluca commented Jan 30, 2025

Image

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

Image

@Borewit
Copy link
Owner

Borewit commented Jan 31, 2025

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.

@jonluca
Copy link

jonluca commented Jan 31, 2025

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.

#2348

@Borewit
Copy link
Owner

Borewit commented Feb 1, 2025

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 Borewit/audio-tag-analyzer#1116.

Relevant change is: Borewit/peek-readable@21b34df

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, will addressed with high priority
Projects
None yet
Development

No branches or pull requests

3 participants