Use with Node.js #541
-
Is it possible to use
This however gives the following error:
It appears that this is caused by Environment.scriptFile. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hi. The usual I added #542 to the backlog but I'm also happy to accept PRs. As a workaround you could try to patch some globals to satisfy the needs of alphaTab. I would need to do some tests but something like the following code might make it work: // set some globals to satisfy alphaTab
global.window = {
devicePixelRatio: 1
};
global.document {
window: global.window
currentScript: {
src: 'alphaTab.js'
}
};
import * as alphaTab from "@coderline/alphatab";
const settings = new alphaTab.Settings();
let score: Score = alphaTab.importer.ScoreLoader.loadScoreFromBytes(data, settings); |
Beta Was this translation helpful? Give feedback.
-
I add globals as below:
|
Beta Was this translation helpful? Give feedback.
-
It occured when i try to use alphatab in next.js app. Have you solved this problem? Maybe you can also give me some hints to walk around this. |
Beta Was this translation helpful? Give feedback.
-
You should be able to get started with https://alphatab.net/docs/guides/nodejs I also added a follow up #545 to provide raster graphics rendering in node environments. Until now only the SVG rendering part is available out-of-the-box. I guess there might be still some "usability" topics which could be improved to integrate alphaTab easier into some workflows. But for this I will need some more concrete use cases. Until now the usage is quite low-level and will require quite some skills to integrate it well into backend rendering workflows. |
Beta Was this translation helpful? Give feedback.
You should be able to get started with https://alphatab.net/docs/guides/nodejs
I just merged #544 and the version with related fixes should be available soon.
I also added a follow up #545 to provide raster graphics rendering in node environments. Until now only the SVG rendering part is available out-of-the-box.
I guess there might be still some "usability" topics which could be improved to integrate alphaTab easier into some workflows. But for this I will need some more concrete use cases. Until now the usage is quite low-level and will require quite some skills to integrate it well into backend rendering workflows.