Closed Kylart closed 4 years ago
Any possibilities to have a working electron example?
I believe electron and "working example" are two mutually exclusive things.
So not possible ? 😞
On X11 and win32 you could embed the mpv window, but then it would cover the electron contents fully with no way to render web content over it (if that is your intention). Maybe (very maybe) you could on win32 create another window on top of that and use alpha transparency (not sure if that works), but that's the end of it.
Then you could do other crappy things, for example render web content into an image, and overlay it on mpv's OSD with mpv's overlay-add
command. Or make mpv render into an offscreen texture, copy that to CPU bitmap, and then transfer that to chromium somehow. But these are very inefficient and have other problems.
Ask Electron for a way to embed native user content (per OpenGL or whatever else there is), then we can talk.
I'm fine with MPV taking full control of the window, I can open a modal window dedicated to this.
@Kylart look at https://github.com/Kagami/mpv.js/
That uses chromium's internal NaCL API, and goes through its internal WebGL layer. Rendering works just in the most basic way, sucks for performance, and might stop working altogether.
There's really no alternative right now. Well, aside from not using Electron. 💩
I already implemented mpv.js
but it has problems especially when it comes to shipping apps easily. Also it uses ppapi (Flash Player) so it's a no for me. It works well on development though.
Electron is not a problem. I know people don't like when using low-level techs. But you can't deny the fact that it's used.
Also. I'm pretty sure it's possible to integrate it just like you'd do it with JavaFX or Cocoa as MPV can attach itself to a window given its native handle. As of now, I can have the native handle address (I guess?) which looks like 0x16e6b040
and I can pass this to native C++ code. As I'm quite new with C++ and low-level techs, I have no idea on how to use it but it's definitely possible.
My plan would be to make a modal window (attached to a parent window) and give MPV full control over it. Seems just like what the cocoa, JavaFX, wxwidgets and other example do, right?
As I said, I can give a solid base with native bindings based on CMake if that helps.
ppapi (Flash Player)
ppapi isn't flash player.
Seems I'm mistaken indeed.
Yes, because browsers are removing all APIs that allow them to interact with native components.
They make for horrible toolkits and you shouldn't use them as one.
You can't share nswindow / nsview pointers across processes on macOS (i.e.: old slave mode). It does work if you are using mpv as a library in the same process though.
It does work if you are using mpv as a library in the same process though.
That it exactly what I want to do. I am using native bindings with direct access to libmpv in the same process.
Any possibilities to have a working electron example?
I know that Electron is made with Node but given that fact that it offers a Native Handle access. Wouldn't it be possible to use this by passing it to the
wid
option? It seems to be exactly what's described for its value.I'm struggling making it work though.
If needed I can give a base with native bindings.