Adds feature flags, and the ability to do browser playback
This commit is contained in:
46
entrypoint.sh
Executable file
46
entrypoint.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if browser playback is enabled
|
||||
if [ "$ENABLE_BROWSER_PLAYBACK" = "1" ]; then
|
||||
echo "Browser playback enabled - setting up audio streaming..."
|
||||
|
||||
echo "Starting PulseAudio..."
|
||||
pulseaudio --start --log-target=syslog --system=false
|
||||
|
||||
# Wait a moment for PulseAudio to initialize
|
||||
sleep 2
|
||||
|
||||
# Create virtual sink
|
||||
echo "Creating virtual audio sink..."
|
||||
pactl load-module module-null-sink sink_name=virtual_output sink_properties=device.description="Virtual_Audio_Output"
|
||||
|
||||
# Make it the default sink
|
||||
pactl set-default-sink virtual_output
|
||||
|
||||
# Create stream directory if it doesn't exist
|
||||
mkdir -p ./dist/frontend/stream
|
||||
|
||||
# Start FFmpeg streaming in background
|
||||
echo "Starting audio stream..."
|
||||
|
||||
FFMPEG_OPTS="-loglevel error -f pulse \
|
||||
-i virtual_output.monitor \
|
||||
-c:a aac -b:a 128k \
|
||||
-f hls \
|
||||
-hls_time 1 \
|
||||
-hls_list_size 3 \
|
||||
-hls_flags delete_segments+append_list \
|
||||
-hls_segment_type mpegts \
|
||||
-hls_segment_filename ./dist/frontend/stream/segment_%03d.ts \
|
||||
./dist/frontend/stream/audio.m3u8"
|
||||
|
||||
echo "FFmpeg options: $FFMPEG_OPTS"
|
||||
|
||||
ffmpeg $FFMPEG_OPTS &
|
||||
else
|
||||
echo "Browser playback disabled - skipping audio streaming setup"
|
||||
fi
|
||||
|
||||
# Start the Node.js server
|
||||
echo "Starting Node.js server..."
|
||||
exec node build/server.js
|
||||
Reference in New Issue
Block a user