jbbqqf
Posts: 1
Joined: Thu Jan 16, 2020 3:37 pm

Transparent windows (RPi3 or 4, electron app)

Thu Jan 16, 2020 4:00 pm

I am working on a project to display an HD video on a RPi (4, but 3 can work as well) with interactive buttons on the foreground. I expect the end result to be similar to this page: https://magic.wizards.com/fr/innistradmap. It looks like an animation, but in reality the page background is a video (https://media.wizards.com/2016/campaign ... p_c491.mp4) and the buttons manipulate the video player to make you feel it's animated.

The naive approach I tried was to embed the video in chromium. But since it's an HD video and I can't manage to make chromium use the hardware acceleration, the 24 fps video drops frames.

On the other hand, omxplayer plays accelerated videos very smoothly. So the second idea I had was to play a background video in omx and use background transparency in my minimal web application. Chromium can't display transparent backgrounds, but electron can. In this post https://stackoverflow.com/questions/535 ... javascript, there is a procedure for a Proof of Concept. The PoC is working well on my debian buster workstation, but the background is not transparent (black) on a bare RPi4 with the latest raspbian desktop.

From what I can read, the transparent background availability is OS dependent (window manager ?). But my knowledge in that area is limited. Can anyone help me understand and what it would require to work ?

I am also open to other suggestions if it achieves the goal described in the first link.

User avatar
Botspot
Posts: 295
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas

Re: Transparent windows (RPi3 or 4, electron app)

Sat Jan 18, 2020 2:04 pm

Most modern linux distributions ship with a compositor. Compositors mainly handle fading windows in and out, shadows, and transparency.

Raspbian is slimmed down for older models, so there is no compositor running by default. But there is one installed. To enable it:

Code: Select all

sudo raspi-config
Navigate using arrow keys and Enter. raspi-config --> Advanced Options --> Compositor --> Yes --> OK --> Finish.
On the next reboot, xcompmgr will autostart with default settings. If you want to change these settings, it's best to disable compositor from raspi-config, and then add your own custom xcompmgr line in ~/.config/lxsession/LXDE-pi/autostart.

Mine looks like this:
xcompmgr -C -c -o 0.5 -l -19 -t -10 -r 14
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

Return to “Advanced users”