Node-MPV icon indicating copy to clipboard operation
Node-MPV copied to clipboard

Embed mpv in Electron Browser Window

Open rexn8r opened this issue 2 years ago • 4 comments

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

rexn8r avatar Apr 17 '22 09:04 rexn8r

just set transparent: true on creating BrowserWindow

moxun33 avatar Nov 10 '22 10:11 moxun33

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?

AxelTerizaki avatar May 16 '23 14:05 AxelTerizaki

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

rexn8r avatar May 18 '23 06:05 rexn8r

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

smartameer avatar Sep 11 '23 08:09 smartameer