Files
docker-selenium/NodeBase/start-selenium-node.sh
Enrique Hernández Bello df46eb17a0 Support for browsers to play video streams (#994)
* Installs libavcodec-extra package for Firefox images.

* Adds support for a PulseAudio virtual sink

* Implement a test to validate if images can play video
2020-03-02 13:31:40 +01:00

55 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
/opt/bin/generate_config > /opt/selenium/config.json
if [ ! -e /opt/selenium/config.json ]; then
echo No Selenium Node configuration file, the node-base image is not intended to be run directly. 1>&2
exit 1
fi
# Start the pulseaudio server
pulseaudio -D --exit-idle-time=-1
# Load the virtual sink and set it as default
pacmd load-module module-virtual-sink sink_name=v1
pacmd set-default-sink v1
# set the monitor of v1 sink to be the default source
pacmd set-default-source v1.monitor
# In the long term the idea is to remove $HUB_PORT_4444_TCP_ADDR and $HUB_PORT_4444_TCP_PORT and only work with
# $HUB_HOST and $HUB_PORT
if [ ! -z "$HUB_HOST" ]; then
HUB_PORT_PARAM=4444
if [ ! -z "$HUB_PORT" ]; then
HUB_PORT_PARAM=${HUB_PORT}
fi
echo "Connecting to the Hub using the host ${HUB_HOST} and port ${HUB_PORT_PARAM}"
HUB_PORT_4444_TCP_ADDR=${HUB_HOST}
HUB_PORT_4444_TCP_PORT=${HUB_PORT_PARAM}
fi
if [ -z "$HUB_PORT_4444_TCP_ADDR" ]; then
echo "Not linked with a running Hub container" 1>&2
exit 1
fi
REMOTE_HOST_PARAM=""
if [ ! -z "$REMOTE_HOST" ]; then
echo "REMOTE_HOST variable is set, appending -remoteHost"
REMOTE_HOST_PARAM="-remoteHost $REMOTE_HOST"
fi
if [ ! -z "$SE_OPTS" ]; then
echo "appending selenium options: ${SE_OPTS}"
fi
rm -f /tmp/.X*lock
java ${JAVA_OPTS} -cp ${JAVA_CLASSPATH:-"/opt/selenium/*:."} org.openqa.grid.selenium.GridLauncherV3 \
-role node \
-hub http://$HUB_PORT_4444_TCP_ADDR:$HUB_PORT_4444_TCP_PORT/grid/register \
${REMOTE_HOST_PARAM} \
-nodeConfig /opt/selenium/config.json \
${SE_OPTS}