mirror of https://github.com/OpenVidu/openvidu.git
openvidu-recording Firefox container fix display num
parent
5124e32a1d
commit
4ac3f4beff
|
@ -1,21 +1,24 @@
|
||||||
FROM ubuntu:16.04
|
FROM ubuntu:20.04
|
||||||
MAINTAINER openvidu@gmail.com
|
MAINTAINER openvidu@gmail.com
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
|
||||||
|
wget \
|
||||||
|
sudo \
|
||||||
|
gnupg2 \
|
||||||
|
apt-utils \
|
||||||
|
software-properties-common \
|
||||||
|
ffmpeg \
|
||||||
|
pulseaudio \
|
||||||
|
xvfb \
|
||||||
|
jq \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install Firefox
|
# Install Firefox
|
||||||
RUN apt-get update && apt-get -y upgrade && apt-get install -y wget sudo
|
RUN apt-get update && apt-get -y upgrade && apt-get install -y firefox
|
||||||
RUN apt-get install -y firefox
|
|
||||||
|
|
||||||
# Install media packages
|
|
||||||
RUN apt-get install -y software-properties-common
|
|
||||||
RUN add-apt-repository ppa:jonathonf/ffmpeg-4
|
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install -y ffmpeg pulseaudio xvfb
|
|
||||||
|
|
||||||
# Install jq for managing JSON
|
|
||||||
RUN apt-get install -y jq
|
|
||||||
|
|
||||||
# Clean
|
# Clean
|
||||||
RUN apt-get autoclean
|
RUN apt-get clean && apt-get autoclean && apt-get autoremove
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
COPY configuration/autoconfig.js /usr/lib/firefox/defaults/pref/autoconfig.js
|
COPY configuration/autoconfig.js /usr/lib/firefox/defaults/pref/autoconfig.js
|
||||||
|
|
|
@ -6,3 +6,5 @@ lockPref("extensions.enabledScopes", 15);
|
||||||
lockPref("security.ssl.enable_ocsp_stapling", false);
|
lockPref("security.ssl.enable_ocsp_stapling", false);
|
||||||
lockPref("network.stricttransportsecurity.preloadlist", false);
|
lockPref("network.stricttransportsecurity.preloadlist", false);
|
||||||
lockPref("network.http.phishy-userpass-length", 300);
|
lockPref("network.http.phishy-userpass-length", 300);
|
||||||
|
lockPref("security.enterprise_roots.enabled", true);
|
||||||
|
lockPref("network.websocket.allowInsecureFromHTTPS", true);
|
|
@ -1 +1 @@
|
||||||
docker build --rm -t openvidu/openvidu-recording:2.10.0-firefox .
|
docker build --rm -t openvidu/openvidu-recording:2.15.0-firefox .
|
||||||
|
|
|
@ -30,38 +30,28 @@ mkdir /recordings/$VIDEO_ID
|
||||||
chmod 777 /recordings/$VIDEO_ID
|
chmod 777 /recordings/$VIDEO_ID
|
||||||
echo $RECORDING_JSON > /recordings/$VIDEO_ID/.recording.$VIDEO_ID
|
echo $RECORDING_JSON > /recordings/$VIDEO_ID/.recording.$VIDEO_ID
|
||||||
|
|
||||||
### Get a free display identificator ###
|
|
||||||
|
|
||||||
DISPLAY_NUM=99
|
|
||||||
DONE="no"
|
|
||||||
|
|
||||||
while [ "$DONE" == "no" ]
|
|
||||||
do
|
|
||||||
out=$(xdpyinfo -display :$DISPLAY_NUM 2>&1)
|
|
||||||
if [[ "$out" == name* ]] || [[ "$out" == Invalid* ]]
|
|
||||||
then
|
|
||||||
# Command succeeded; or failed with access error; display exists
|
|
||||||
(( DISPLAY_NUM+=1 ))
|
|
||||||
else
|
|
||||||
# Display doesn't exist
|
|
||||||
DONE="yes"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
export DISPLAY_NUM
|
|
||||||
|
|
||||||
echo "First available display -> :$DISPLAY_NUM"
|
|
||||||
echo "----------------------------------------"
|
|
||||||
|
|
||||||
pulseaudio -D
|
pulseaudio -D
|
||||||
|
|
||||||
### Start Chrome in headless mode with xvfb, using the display num previously obtained ###
|
### Start Chrome in headless mode with xvfb, using an automatically provided free display num ###
|
||||||
|
|
||||||
touch xvfb.log
|
touch xvfb.log
|
||||||
chmod 777 xvfb.log
|
chmod 777 xvfb.log
|
||||||
xvfb-run --server-num=${DISPLAY_NUM} --server-args="-ac -screen 0 ${RESOLUTION}x24 -noreset" firefox --width $WIDTH --height $HEIGHT $URL &> xvfb.log &
|
xvfb-run --auto-servernum --server-args="-ac -screen 0 ${RESOLUTION}x24 -noreset" firefox --width $WIDTH --height $HEIGHT $URL &> xvfb.log &
|
||||||
touch stop
|
touch stop
|
||||||
chmod 777 /recordings
|
chmod 777 /recordings
|
||||||
|
|
||||||
|
until pids=$(pidof Xvfb)
|
||||||
|
do
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
|
||||||
|
### Calculate the display num in use parsing args of command "Xvfb"
|
||||||
|
|
||||||
|
XVFB_ARGS=$(ps -eo args | grep [X]vfb)
|
||||||
|
DISPLAY_NUM=$(echo $XVFB_ARGS | sed 's/Xvfb :\([0-9]\+\).*/\1/')
|
||||||
|
echo "Display in use -> :$DISPLAY_NUM"
|
||||||
|
echo "----------------------------------------"
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
### Start recording with ffmpeg ###
|
### Start recording with ffmpeg ###
|
||||||
|
|
Loading…
Reference in New Issue