- DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 nohup /usr/bin/mplayer -ao pulse --quiet "${_DATA}/videos/$info" >/dev/null 2>/dev/null &
- redirect "$HTTP_REFERER"
+ [ -n "$location" ] && playuri="${treeroot%/}/${location#/}"
+ [ -n "$info" ] && playuri="${_DATA}/videos/$info"
+
+ fifofile="${_DATA}/mplayer.fifo"
+ volume="$(validate "$(cat "${_DATA}/mplayer.volume")" '[1-9]?[0-9]|100' 20)"
+ [ \! -p "$fifofile" ] && rm -f "$fifofile" && mkfifo -m 600 "$fifofile"
+
+ debug PLAYURI $playuri
+
+ DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \
+ nohup /usr/bin/mplayer -ao pulse -quiet \
+ -slave -input file="$fifofile" \
+ -volume "$volume" \
+ "$playuri" >/dev/null 2>/dev/null &
+
+ # # MPlayer2:
+ # DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \
+ # nohup /usr/bin/mplayer -ao pulse --quiet \
+ # --slave --input=file="$fifofile" \
+ # --volume="$volume" \
+ # "$playuri" >/dev/null 2>/dev/null &
+
+ redirect "?p=playctl&${watch_link}"