Closed volodymyrbalytskyy closed 11 months ago
I will probably not be able to help with that as I don't own any Apple devices.
You could check this CodePen though. When you load the main script from https://unpkg.com/mediainfo.js/dist/umd/index.min.js
, the WASM file is loaded from the parent directory https://unpkg.com/mediainfo.js/dist/
. This just works without even using locateFile
.
Does the CodePen also fail in Safari?
Another solution would be a crude URL rewrite, here's one we use.
{
// Rewrites requests for the wasm file to the correct location due to
// bug with locateFile in mediainfo.js in Safari.
source: "/:path*/MediaInfoModule.wasm",
destination: "/MediaInfoModule.wasm",
},
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 30 days since being marked as stale.
Issue Summary
WASM module location can be overridden with
locateFile
property. In Chrome and Firefox it appears to work correctly, but in Safari 16 thelocateFile
override is not picked at all and it tries to fetch the WASM module from the URL the user is currently on (the default behavior).Steps to Reproduce
For this purpose, created a bare-bones repo which contains a Vite boilerplate and React. https://github.com/volodymyrbalytskyy/mediainfo_locate_safari
yarn
and thanyarn dev
http://127.0.0.1:5173
in Safari browser (port might be different, check output from step 2)EXPECTED behavior
in the Netwrok, the WASM module should be downloaded from
https://unpkg.com/mediainfo.js@0.1.9/dist/MediaInfoModule.wasm
aslocateFile
was set to that URL. Here is a snippet preview and actual code snippet here:Here is a screenshot from Chrome
ACTUAL behavior
WASM module is downloaded from
http://127.0.0.1:5174/MediaInfoModule.wasm
Here is a screenshot from Safari 16