RPI 在本地机器上通过 php 启动 VLC

时间:2021-08-01 13:13:39

标签: php terminal raspberry-pi exec vlc

我正在尝试通过 RPI 3 上的 PHP .mp4 命令在 VLC 中打开一个 exec 文件

情况 我访问 localhost 并选择要在移动设备上播放的 .mp4 文件。

结果 我希望 PHP 在主机上使用 VLC 打开视频文件,主机通过 HDMI 连接到显示器。

正在使用的命令是

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

结果是在主机上什么也没有打开,结果是:

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

我在使用不同的命令时也遇到过这个错误:

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.

1 个答案:

答案 0 :(得分:0)

我最终不得不运行一个 python 脚本,它每 5 秒检查一次本地文件,然后通过它打开电影。 PHP 脚本会在需要时将 .mp4 名称写入文件。