Pisound simple script launch button problem

Hi there,
I’m clueless.
I’m in need of lauching a video (m4v) using the Button.

I made a script to lauch the vid via VLC (cvlc).
bash ./myscript.sh
It works.

Stored in the pisound button scripts folder, i can use the pisound config to assign the button to myscript.sh

But pressing the button, it won’t lauch.
What am i missing?

In case Pisound was unable to lauch a script with a vlc, i made an other script that launches the main script.
Now i have a VLC “cannot be used as root” problem, so, my guess is it is more of a VLC issue.

Pisound button scripts are executed as root user, you may have to set some environment variables for the display environment and change the user if necessary. Things like:

su pi -c "DISPLAY=:0 vlc ..." &

Note the & at the end - it starts the process in background mode, otherwise, the button won’t respond, until the last started process exits.

Or just invoke your own .sh script through a button script using su.

Hey, Giedrius!
I cant thank you enough.
I was looking for how launch it as a user and your line of code worked like a charm.
I added a pkill function to the button double click, and we ‘re all set !
Problem solved !
Thank you !

1 Like