Giter Site home page Giter Site logo

Electron example about mpv-examples HOT 13 CLOSED

Kylart avatar Kylart commented on August 11, 2024 1
Electron example

from mpv-examples.

Comments (13)

CounterPillow avatar CounterPillow commented on August 11, 2024 2

Any possibilities to have a working electron example?

I believe electron and "working example" are two mutually exclusive things.

from mpv-examples.

Kylart avatar Kylart commented on August 11, 2024 1

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.

from mpv-examples.

Kylart avatar Kylart commented on August 11, 2024

So not possible ? 😞

from mpv-examples.

 avatar commented on August 11, 2024

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.

from mpv-examples.

Kylart avatar Kylart commented on August 11, 2024

I'm fine with MPV taking full control of the window, I can open a modal window dedicated to this.

from mpv-examples.

pigoz avatar pigoz commented on August 11, 2024

@Kylart look at https://github.com/Kagami/mpv.js/

from mpv-examples.

 avatar commented on August 11, 2024

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.

from mpv-examples.

pigoz avatar pigoz commented on August 11, 2024

There's really no alternative right now. Well, aside from not using Electron. 💩

from mpv-examples.

CounterPillow avatar CounterPillow commented on August 11, 2024

ppapi (Flash Player)

ppapi isn't flash player.

from mpv-examples.

Kylart avatar Kylart commented on August 11, 2024

Seems I'm mistaken indeed.

Still seems to be deprecated though

from mpv-examples.

CounterPillow avatar CounterPillow commented on August 11, 2024

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.

from mpv-examples.

pigoz avatar pigoz commented on August 11, 2024

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.

from mpv-examples.

Kylart avatar Kylart commented on August 11, 2024

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.

from mpv-examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.