j-holub / Node-MPV

A NodeJs Module for MPV Player
https://www.npmjs.com/package/node-mpv
MIT License
116 stars 73 forks source link

Embed mpv in Electron Browser Window #106

Open rexn8r opened 2 years ago

rexn8r commented 2 years ago

Hello

I am trying to embed mpv into an electron browser window using following code:

//get browser window hwnd const winID = remote.getCurrentWindow().getNativeWindowHandle().hbuf.readInt32LE(0); const mpv = new mpvAPI({ binary: "C:\Users\UserA\mpv\mpv.exe" },["--wid=" + winID]);

await mpv.start(); await mpv.load(exePath + "\content\Demo.mp4"); console.log(await mpv.getDuration());

When i run the electron app, i don't see the video. The mpv instance seem to have started as i get the duration value in the console.

if i remomve --wid option then i can see the video window.

can any expert throw light on this issue?

thanks rex

moxun33 commented 1 year ago

just set transparent: true on creating BrowserWindow

AxelTerizaki commented 1 year ago

I'm late to the party but what's the actual point of embedding mpv into a window that way? mpv will cover the entire window, right? so you can't decorate it via Electron, can you?

rexn8r commented 1 year ago

hi @AxelTerizaki

I am developing a digital signage player application where in i would like to show video files via mpv in one zone along with other content like ticker or image banner in different zones.

the idea is to load mpv window with custom x, y, width , height on a screen with other content alongside.

thanks

smartameer commented 10 months ago

With electron, i suppose we have to get the mpv stream url to run as a network stream on to a html5 video/audio/embed tag. The stream url should be on a web/http/ws/webrtc server.

Not sure if mpv supports these? #95

Ref: #83