Failing to find font and soundfont files when hosting from a directory that isn't the root #1629
-
I'm using vite for my application and I got this library working well in dev mode. However, when I deploy the vite build to my website, I'm getting a 404 on the font and soundfont files. The problem is that I'm hosting from a directory that isn't the root but the requests for the font files are being made to the root. For example, if the website I'm trying to host from is example.com/sandbox, it's trying to find example.com/font/Bravura.woff instead of example.com/sandbox/font/Bravura.woff. I've tried changing the base path on the vite config file but that didn't work. I've also tried adding a base path tag on the index.html file but that didn't work either. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You need to configure this setting according to your app: See also: The fontDirectory setting is used to generate a style tag with the web font definitions: Line 121 in 8d816be The soundFontUrl is used to load the file via Ajax: |
Beta Was this translation helpful? Give feedback.
You need to configure this setting according to your app:
https://www.alphatab.net/docs/reference/settings/core/fontdirectory
See also:
https://github.com/CoderLine/alphaTabSamplesWeb/blob/main/src/vite-vue/src/App.vue#L12
https://github.com/CoderLine/alphaTabSamplesWeb/blob/main/src/vite-react/src/App.tsx#L13
The fontDirectory setting is used to generate a style tag with the web font definitions:
alphaTab/src/Environment.ts
Line 121 in 8d816be
The soundFontUrl is used to load the file via Ajax:
alphaTab/src/platform/javascript/AlphaSynthWebWorkerApi.ts
Line 282 in 8d816be