#!/usr/bin/env bash # Headless PulseAudio for the broadcast audio path. # # The selfbot streamer captures desktop audio with `ffmpeg -f pulse -i # @DEFAULT_MONITOR@` (bot/src/stream/selfbot.ts). In a container there is no # real sound card, so we run a PulseAudio daemon with a null sink set as the # default: Chrome/desktop play into it, and its `.monitor` source is what # ffmpeg captures. Without this the broadcast fails to start when STREAM_AUDIO=1. set -e export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/0}" mkdir -p "$XDG_RUNTIME_DIR/pulse" chmod 700 "$XDG_RUNTIME_DIR" exec pulseaudio \ --exit-idle-time=-1 \ --disallow-exit \ --disable-shm \ -n \ --load="module-native-protocol-unix auth-anonymous=1 socket=${XDG_RUNTIME_DIR}/pulse/native" \ --load="module-null-sink sink_name=virtual_speaker sink_properties=device.description=Virtual_Speaker" \ --load="module-always-sink" \ --log-target=stderr