browser-box: add support for video devices

pull/3/merge
Sameer Naik 9 years ago
parent 6ed2bc7854
commit 3710ea1520

@ -49,7 +49,19 @@ case "$1" in
--gecos 'Browser Box' ${WEB_BROWSER_USER}
fi
# launch application as ${WEB_BROWSER_USER}
# grant access to video devices
for device in /dev/video*
do
if [[ -c $device ]]; then
VIDEO_GID=$(stat -c %g $device)
break
fi
done
if [[ -n $VIDEO_GID ]]; then
usermod -a -G $VIDEO_GID ${WEB_BROWSER_USER}
fi
cd /home/${WEB_BROWSER_USER}
exec sudo -u ${WEB_BROWSER_USER} -H PULSE_SERVER=/run/pulse/native $@ ${extra_opts}
;;

@ -28,6 +28,15 @@ else
fi
done
# enumerate video devices for webcam support
VIDEO_DEVICES=
for device in /dev/video*
do
if [ -c $device ]; then
VIDEO_DEVICES="${VIDEO_DEVICES} --device $device:$device"
fi
done
echo "Starting ${prog}..."
touch ${XAUTH}
docker run -d \
@ -36,6 +45,7 @@ else
--env="USER_GID=${USER_GID}" \
--env="DISPLAY" \
--env="XAUTHORITY=${XAUTH}" \
${VIDEO_DEVICES} \
--volume=${XSOCK}:${XSOCK} \
--volume=${XAUTH}:${XAUTH} \
--volume=/run/user/${USER_UID}/pulse:/run/pulse \

Loading…
Cancel
Save