fsquillace / junest

The lightweight Arch Linux based distro that runs, without root privileges, on top of any other Linux distro.
GNU General Public License v3.0
2.08k stars 111 forks source link

Pass audio through to host #264

Closed aDogCalledSpot closed 3 years ago

aDogCalledSpot commented 3 years ago

I'm trying to use media players through junest and noticed I wasn't getting any sound.

I installed pulse and alsa but pulse doesn't detect any sinks (or sources).

According to the PulseAudio FAQ, a chroot would need access to a few directories on the host, of which only /var/lib/dbus currently isn't already shared between the host and the client. I assume this won't change for other junest backends.

I tried running junest -b "--bind /var/lib/dbus /path/to/.junest/var/lib/dbus" but that doesn't appear to work as the content of the two directories is different.

fsquillace commented 3 years ago

I never tried to connect pulseaudio. I am wondering if you also need to bind the directory: /run/user/$USER/pulse/.

If you find a way please share so that I will put it in the junest wiki section.

smtnskn commented 3 years ago

Here's how I got it working.

Run netstat on the host to determine where PulseAudio keeps its sockets:

~ # netstat -lnp | grep pulseaudio
unix  2      [ ACC ]     STREAM     LISTENING      22035 3813/pulseaudio     /run/user/1000/pulse/dbus-socket
unix  2      [ ACC ]     STREAM     LISTENING      22037 3813/pulseaudio     /run/user/1000/pulse/native

/run/user/1000/pulse/native is what we need.

Now run junest and bind the socket: junest -b "--bind /run/user/1000/pulse/native /path/to/.junest/run/pulse/native"

Finally, within junest use the PULSE_SERVER variable to tell applications where to find the socket: export PULSE_SERVER=unix:/path/to/.junest/run/pulse/native

aDogCalledSpot commented 3 years ago

Terrific! I would also add that if you don't have another desktop environment running, then you would first have to start the pulse server with pulseaudio --start.

bayazidbh commented 2 years ago

Hi, does this work with pipewire? I am a Fedora 35 user, I know that pipewire can handle pulseaudio but I don't know if it'll pick it up and if the process is the same.

eth0OS commented 2 years ago

Hi, does this work with pipewire? I am a Fedora 35 user, I know that pipewire can handle pulseaudio but I don't know if it'll pick it up and if the process is the same.

Yes, it does, since pipewire is build in a way to be 100% compatible with pulseaudio you don't even need to change any command, just run them as said above and it will work fine

Nidrop commented 1 year ago

Now the pulseaudio works out of the box because of #313. And the wiki page is no longer needed