Skip to content
Advertisement

RPI Launch VLC via php on local machine

I am trying to open a .mp4 file in VLC via the PHP exec command on a RPI 3

SITUATION I access localhost and select the .mp4 file I want to play on a mobile device.

RESULT I want PHP to open the video file using VLC on the host machine, which is connected via HDMI to a display.

The command in use is

exec("DISPLAY=:0 /usr/bin/vlc --fullscreen /var/www/html/videos/".$video.".mp4 2>&1 &");

The result is nothing opening on the host machine and a result of:

[004af128] [cli] lua interface: Requested shutdown.

I have also had this error with a different command:

vlc No protocol specifiedxcb_connection_has_error() returned trueHome directory not accessible: Permission denied[011489b0] vlcpulse audio output error: PulseAudio server connection failure: Connection refusedNo protocol specifiedxcb_connection_has_error() returned trueHome directory not accessible: Permission denied[01142708] dbus interface error: Failed to connect to the D-Bus session daemon: /usr/bin/dbus-launch terminated abnormally with the following error: No protocol specifiedAutolaunch error: X11 initialization failed.

Advertisement

Answer

I ended up having to run a python script that checks a local file every 5 seconds and will open the movie via that. The PHP script will just write the .mp4 name to the file when it needs to.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement