Replies: 1 comment
-
Hi there. I haven't used preloaded resources before and just did a quick reading on them. Here some feedback to get the discussion started: Bravura Music FontAs you know alphaTab uses the SMuFL compatible font alphaTab requests a web-font load via CSS: Lines 114 to 122 in 657f884 alphaTab uses the FontLoadingChecker to get notified when the font is actually loaded and available before starting any rendering.
So far I do not see where alphaTab might be blocking the use of preloaded web fonts. Font Load is requested via the usual Depending on your project setup you might want to supply an explicit Maybe you can prepare a jsfiddle, codepen or similar showing the issue. Then we have a starting point to check why the preload might not work. SoundFontThe soundfont is indeed a nasty big file degrading performance of the page init. I am aware that loading can take long, that's why we have all the related events to have a proper UI indication that things are still initializing. You will see similar loading indicators when using the proriertary notation renderers like Ultimate Guitar or Soundslice. There are various ways to address this topic:
The right e.g. if you use the default Sonivox Soundfont, you can let it point to the JSDelivr CDN: https://www.jsdelivr.com/package/npm/@coderline/alphatab?path=dist%2Fsoundfont Otherwise I would recommend extending your app/website with a custom local cache (e.g. via local storage, IndexDB, browser cache API). Download the soundfonts on your own via AJAX, put it to the cache and use
Can you elaborate where alphaTab might be lacking of features to be more compliant with the spec? In general I agree that the standard behavior of alphaTab does not do all these things out of the box. But this is also intended like that. alphaTab rather offers a rich API to allow developers to use it in a flexible way. Things might become different in releases like 1.5+ when we really ship an all-in-one control for easy integration without development skills. Until then, loading any external data efficiently and passing it to alphaTab is the "integrators duty". 😉 More preloadingIf you preload the overall alphaTab JavaScript bundle via |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am getting used to the new API, and really like it compared to how things worked in the past and I have managed to remove JQuery from my pages, however I have also started working with preloading resources, e.g.,
<$scorefont>;rel=preload;as=font;crossorigin
however it does not work with AlphaTab, since the resource is merely downloaded again, whether via HTML, or JavaScript.
I know there is no "as" attribute, for sf2, but being able to at least use fonts in what is arguably a standard way, I believe would help in relation to faster page loads and interactivity, since Lighthouse shows scores well below 50 and I think this is an area where improvement might be able to be made.
In addition, the library does not seem to work well with the Service Worker specification, and while the specification itself has not been formalized, I believe it to be part of the future of the web; in particular for Progressive Web Applications, and installing single pages to devices.
All in all, this is a great library, the only one worth working with in my view because of the fantastic support provided, which does not result in deadware.
Beta Was this translation helpful? Give feedback.
All reactions