这篇文章提供了以下 bash 脚本:
#!/bin/sh
# get rid of the cursor so we don't see it when videos are running
setterm -cursor off
# set here the path to the directory containing your videos
VIDEOPATH="/mnt/storage/videos"
# you can normally leave this alone
SERVICE="omxplayer"
# now for our infinite loop!
while true; do
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
sleep 1;
else
for entry in $VIDEOPATH/*
do
clear
omxplayer $entry > /dev/null
done
fi
done
我已将对 omxplayer 的调用更改为全屏并输出声音:
omxplayer -r -o hdmi $entry > /dev/null
但即使在更改为我的首选设置之前,脚本似乎只播放文件夹中的第一个视频,它会无休止地循环播放。我已经检查了视频的权限,它们都归运行脚本的用户所有。