antonok-edm / vst_window

Cross-platform windowing library for VST plugins, written in Rust
MIT License
37 stars 5 forks source link

Is it possible to use WebView for VST UI? #1

Open satelllte opened 3 years ago

satelllte commented 3 years ago

Hey @antonok-edm ✋

I'm trying to understand is it possible to use WebView for VST UI? For example, using these bindings: https://github.com/Boscop/web-view

antonok-edm commented 3 years ago

Hey @egormesyats!

I've looked into it briefly - there is an open call for contribution on the README:

  • Make it possible to create the webview window as a child window of a given parent window. This would allow webview to be used for the GUIs of VST audio plugins in Rust.

Currently web-view builds a window from scratch. vst_window on the other hand is designed to set up a window pointer and prepare it as a RawWindowHandle, which allows cross-platform compatibility with other Rust windowing and rendering libraries.

It's probably not easy to build RawWindowHandle support into web-view, but conceivably web_view::Builder could provide a .raw_window_handle(handle) method to build into an existing window rather than creating a new one.

Short of that, I'd recommend using an existing drawing library like wgpu (ampli-Fe is a good example of how that can be accomplished).

satelllte commented 3 years ago

Got it. Thank you for your answer @antonok-edm :)

After another day of research, I found something interesting: https://github.com/mikesoylu/rust-vst-gui I tested it on Mac and it did work!

If you're interested more you can check this branch on my fork: https://github.com/egormesyats/rust-vst-gui/pull/1. I've just added build scripts for Mac there.

Actually, @mikesoylu did a very good job making it work with web-view 🔥 It's probably worth creating a crate like vst_webview in the future. What do you think?

antonok-edm commented 3 years ago

I think a crate like that would be pretty useful for a lot of developers! Nice to see that it is possible already.

Looks like it doesn't work on Linux at the moment, which was my biggest motivation for creating vst_window in the first place - but it's probably not too difficult, relatively speaking.