HTML/JS user interfaces #290
Replies: 9 comments 25 replies
-
Hello and thanks for all the work! I am a bit apprehensive about HTML on plugin UIs, but maybe indeed there is sometimes a good use for them. Quick look through the code, I have a few more comments:
|
Beta Was this translation helpful? Give feedback.
-
btw, develop DPF has a "stub" target now too. something that does not setup openGL, cairo or any graphics backend. |
Beta Was this translation helpful? Give feedback.
-
DPF minimalism if one of its greatest strengths and agree on that. The plugin shell approach like Chibi sounds a lot better, I was not aware of it. The best of these things and it also applies to JACK is being modular and they should remain the same. I agree on JACK not hard to get working but er... you know people sometimes are lazy :). I have some ideas to help on that but it would be dishonest to continue the rant because I am lazy myself to implement them. Just bringing up the point that an extra step in the workflow bothers some poeple and that is out of the developers control, especially on those systems where everything is "automatic". No wonder why Pro Tools looks basically the same as 30 years ago. In fact dpf-webui was conceived as the starting point for a port of a custom modular system developed in the past based on Python, the hacked Live Live API, HTML/JS, some audio utilities and JACK for inter-app audio. Replicating the setup on someone else's computer proved to be non trivial. It occurred to me that if I tried to (forgive me) glue everything together into a VST plugin it would make it easier to share the thing with bandmates and eventually release it to the general public. So the workflow remains the same for them, start the DAW and forget. Audio routing is done inside the DAW, the visual interface can be casted to the network, etc. It is a very specific case. I saw the "stub" target yesterday and had a vague idea, the comment confirms I definitely need to dig into it. The web view only needs a pointer to the native parent view, thanks ! |
Beta Was this translation helpful? Give feedback.
-
There is a new branch https://github.com/lucianoiam/dpf-webui/tree/moredpf . The class hierarchy looks like this now:
I naively tried switching UI_TYPE to stub but the project won't compile so there is clearly something I am overlooking. I am still not familiar with the DPF design; everything built so far was done on top of it and not hooking into it. The top level UI for this project was implemented as a derived class of Following your convention, isn't Summarizing in inaccurate terms, this is what I'm thinking of:
|
Beta Was this translation helpful? Give feedback.
-
So to be clear, it is best that webview is a top-level-widget, so we do not have to deal with child windows, partial embedding and stuff like that. Basically, think of Web/HTML as a target backend within DPF - So we get Cairo, OpenGL or Web/HTML. |
Beta Was this translation helpful? Give feedback.
-
It's been some time since this, finally the project evolved into web UI support (JavaScript) and optionally web DSP as well (AssemblyScript). More or less at beta stage at this point repo here. The result is pretty solid, there is a single thing I could still not fix but related to WebKitGTK and not DPF. There is a workaround in place but it breaks CSS viewport-based units on Linux. The current webview version finally subclasses SubWidget for historic (read: lazy) reasons but now #313 looks like the best approach. Also just discovered https://github.com/LDPF , referencing relevant discussion here LDPF@4cbed01 |
Beta Was this translation helpful? Give feedback.
-
That's correct. There is a single caveat, maybe you know something about this. The GTK webview must be attached to a GtkWindow. Since the x11 window can already exist (ie, provided by the host) it is wrapped like this: GdkWindow* gdkChild = gdk_x11_window_foreign_new_for_display(gdk_display_get_default(), x11_window); This works great but the webview does not seems to follow this special Gtk/GdkWindow resize events afterwards. Not to blame DPF, maybe you have experience wrapping x11 windows for use in Gtk and there are known limitations when "adopting" windows. In the meantime I filed a bug at the WebKitGTK tracker. The current workaround is to create the webview with fixed large dimensions (like 2000x2000), it will be cropped by the wrapping window. And then use CSS for manipulating the body dimensions. As ugly as it sounds it works very good but it prevents vh/vw/etc from working correctly. This only applies to Linux. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the snippet will have a look at it. Resizing works as expected when creating a "normal" standalone GtkWindow and attaching the webview to it with no extra effort, it just works. There has to be a difference between a regular GtkWindow and the wrapped x11 version, already discovered that the latter does not emit some events maybe it is that. Not sure it is a supported setup though. |
Beta Was this translation helpful? Give feedback.
-
Continuation of #316 I like the idea of integrating all webview development into DPF. I started the project out of necessity as the first step of a project that needs a complex UI and runs on all desktop platforms. As a side effect, later discovered some overlap with the growing territory of web audio projects. I see two main approaches:
Right after both parts (external-ui and webview) are complete sounds like the right time to study how to merge. The current webview can already produce working plugins that depend on DGL example here , and there is a separate no-DGL branch that is already complete, minus standalone. I would start by completing external-ui, then probably work a little more on the UI class as explained below to pave the way for integration. Sharing some thoughts including long term ideas. The webview project provides two main classes, AbstractWebHostUI and AbstractWebView:
Then we have the WasmPluginHost but that is easier to handle because it does not require graphics. It is quite complete, including a subset of the DPF Plugin API ported to AssemblyScript. Long term: the only thing I am not sure about is keeping Wasmer as the Wasm engine, or switch to something minimal like WAMR. Time will tell, some stuff is even still discussed by the Wasm people. Well there are some details to think about, tried to keep it short. |
Beta Was this translation helpful? Give feedback.
-
Hi @falkTX. I've been working on this for a while https://github.com/lucianoiam/dpf-webui and wondering if it makes sense to integrate it into DPF as one of the UI_TYPEs . While it is overkill for typical plugin work consisting of knobs and switches, It could be interesting for building more app-like complex UIs (thinking of the various JS frameworks out there). I personally dislike webapps but in contrast to let's say Electron, this is not about embracing JS for everything but rather adding some bits of its goodness to the already wild world of plugin UIs. And of course leveraging a full web rendering engine for flexbox, canvas, SVG, etc. It could work for some specific cases while following the DSP/UI separation paradigm DPF enforces.
A more generic, perhaps better integration could involve turning the web view into one of DPF's native Widgets. Then explain the web-based user interface approach in one of the example projects. This breaks dpf-webui into two separate tools: a reusable webview and a JS bridge to DISTRHO::UI.
I think of dpf-webui as a naive but working implementation of a (debatable) good idea which is throwing some higher level language pieces on top of the audio engine core like Bitwig does, or a quite recent project called React-JUCE. While drawing from DPF's spirit of not complicating things.
The interfaces to the system web views were written from scratch to ensure they are safe to run in a plugin context on all platforms. No dependencies needed.
Being said this, thanks to the DPF team for all the great work.
Beta Was this translation helpful? Give feedback.
All reactions