mpv.net icon indicating copy to clipboard operation
mpv.net copied to clipboard

Cross-Platform Support with OpenGL Render API

Open mysteryx93 opened this issue 4 years ago • 5 comments

Any plans to make this cross-platform compatible?

Converting from WPF to Avalonia would be easy.

One problem would be using OpenGL Render API instead of WindowsFormHost

mysteryx93 avatar Nov 13 '21 19:11 mysteryx93

I want to learn how to use Linux in the next 1-2 years, but won't have enough time for such a large and difficult mpv.net cross-platform project.

Is there any purpose in using the render API, apart from just liking the topic? Just because it can be done doesn't make it a good idea. I would rather use a different UI framework for each platform for the main window and let libmpv taking care of the rendering by passing it a window handle:

https://mpv.io/manual/master/#options-wid

Other windows apart from the main dialog can be done with Avalonia, however, other dialogs are not important anyway, nice to have but not essential.

stax76 avatar Nov 14 '21 12:11 stax76

Due to the various platform-specific behavior and problems (in particular on OSX), using the render API is currently recommended over window embedding. In some cases, window embedding can be preferable, because it is simpler and has no disadvantages for the specific use case.

You also get much more flexibility. For example, you can actually render your own OSD on top of the video, something that is not possible with raw window embedding.

WID embedding works fine on Linux and Windows but not on MacOS. Then Android and iOS could also be interesting use-cases; Avalonia will support that soon.

mysteryx93 avatar Nov 14 '21 16:11 mysteryx93

More importantly, wID integration only works in WinForms and WPF. For UWP, WinUI, Avalonia, UNO... have no choice but to use the OpenGL Render API.

As a personal note, WPF has many design flaws and few people use it, and Microsoft just keeps releasing UI framework after UI framework without any standardization. WPF, UWP, and then WinUI 3, MAUI -- WinUI 3 still in beta, and after all this, still won't have proper cross-platform support for Linux. And with all the excitement around Windows 11, I expect Linux to grow a LOT over the next 3 years.

UNO is cross-platform but currently limited by UWP's limitations, until they base their syntax on WinUI 3 but that's for the future.

Meanwhile, Avalonia is growing tremendously in popularity, has excellent support in JetBrains Rider (they give free license for open-source projects like this), and has a much more stable API than Microsoft's flipping UI platforms.

IMO Avalonia is the way to go for the future. (although I'm just starting to explore it)

mysteryx93 avatar Nov 14 '21 22:11 mysteryx93

Time will tell what the future is, keep exploring, I'm doing it too.

stax76 avatar Nov 15 '21 09:11 stax76

Related topic: https://github.com/stax76/mpv.net/discussions/405

stax76 avatar Apr 11 '22 08:04 stax76