FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.35k stars 72 forks source link

Docker Container #55

Closed markst closed 2 years ago

markst commented 2 years ago

Is there any reason why this couldn't run in a Docker container?

I've managed to install all the dependencies & build using debian:buster base image.

I can get it to run into a state where by the following outputs:

supported audio format 1: AAC-ELD 44100/2
supported audio format 2: ALAC 44100/16/2
supported audio format 3: AAC-LC 44100/2
supported audio format 4: PCM 44100/16/2 S16LE
Initialized GStreamer video renderer
using system MAC address 6c:4b:90:ce:67:18
Initialized server socket(s)

In which the server doesn't appear on my client.

So could well mean it's an Avahi issue.

I've attempted to install avahi-daemon, but when attempting to run prior to executing uxplay the following occurs:

[ ok ] Starting system message bus: dbus.
[....] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemonTimeout reached while wating for return value
Could not receive return value from daemon process.
 (warning).

Here's my start.sh script:

#!/bin/bash

/etc/init.d/dbus start
/etc/init.d/avahi-daemon start

uxplay -d
markst commented 2 years ago

Here's how I'm running the command in the container:

docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -e XAUTHORITY=$XAUTHORITY -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR --net host -it test
fduncanh commented 2 years ago

(I dont have experience with docker.)

server not appearing on client is usually an avahi issue. occasionally its a network issue. see Troubleshooting section of README

Have you got it working first without docker?

markst commented 2 years ago

Yes working great without docker.

Okay, I'll look into avahi issue & report back here.

Thanks.

markst commented 2 years ago

Managed to avahi working using ubuntu:20.04 base image, however running UxPlay would not cause server to appear.

Sure I could probably take some inspiration from https://github.com/RagingTiger/shairport-sync

However I've managed to get it working by sharing my host's avahi-daemon:

docker run -v /tmp/.X11-unix:/tmp/.X11-unix \
           -v /var/run/dbus:/var/run/dbus \
           -v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \
           -v /run:/run \
           -e PULSE_RUNTIME_PATH=/run/pulse \
           -e DISPLAY=$DISPLAY \
           -e XAUTHORITY=$XAUTHORITY \
           -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
           --network=host \
           --device /dev/snd \
           -it uxplay

Works great besides no audio currently. Still trying to figure that out, whether I need to set my audio device.

fduncanh commented 2 years ago

Good to see you have progress. uxplay -as pulsesink should connect to pulse audio

markst commented 2 years ago

Thanks, I've tried installing alsa/pulse sinks & specifying them like you suggest.

I'm sure it's something to do with Docker device bridging, probably something quite obvious to some.

There's some advice on this thread which I haven't had the chance to try out: https://forum.libreelec.tv/thread/24308-docker-container-audio-output-to-libreelec/?postID=158538&highlight=docker%2Bairplay#post158538

markst commented 2 years ago

Closing issue in favour or repo: https://github.com/markst/plugin.audio.uxplay