Open itlancer opened 2 months ago
Hi
These audio issues, when trying to run AIR as root, appear to be caused by the fact that AIR on Linux is using PulseAudio, and per the above messages, this may not be set up to work for a 'root' client.
The best workaround might be to set up your PulseAudio system to run as root or to allow root connections. e.g. try:
sudo pulseaudio -D
We get the result:
W: [pulseaudio] main.c: This program is not intended to be run as root (unless --system is specified).
So maybe if you can change the Linux machine to allow PulseAudio to run as root, or to allow connections from a root process, this could then work?
See also https://www.reddit.com/r/linux_gaming/comments/5tidzc/a_solution_for_pulseaudio_pa_context_connect/ https://forums.raspberrypi.com/viewtopic.php?t=340709
@ajwfrost Thank you for suggestions! Unfortunately it doesn't work with Ubuntu 24 cause seems it use Pipewire instead of PulseAudio right now by default. I didn't found the way to workaround it still via machine configuration.
But for other Linux under root sound issues (not related to AudioDeviceManager.audioDeviceManager.deviceNames
) it could be avoided by launching via sudo -E
or passing XDG_RUNTIME_DIR
(as mentioned in workarounds).
Even with latest Ubuntu 24.
I will try to research Ubuntu 24 with Pipewire more and also check suggestions with Ubuntu 22 or below.
But specifically for current issue main problem is that audio stop working at all if AIR application under root call AudioDeviceManager.audioDeviceManager.deviceNames
for Linux.
Problem Description
No sound can be played after
AudioDeviceManager.audioDeviceManager.deviceNames
call when AIR application run under sudo with Linux. Sometimes multimedia applications should be run with root privileges (for example when autostart enabled). That's why it is crucial. Same issues withVideo
with audio playback too, withNetStream::appendBytes()
and with M4A audio playback viaNetStream
.Tested with multiple AIR versions, even with latest AIR 51.1.1.3 with multiple different Linux x86_64 devices (VM and real), different OS versions and different applications. There is no such issue without sudo. There is no such issue using
aplay
. There is no such issue with other platforms.Related issues: https://github.com/airsdk/Adobe-Runtime-Support/issues/3450 https://github.com/airsdk/Adobe-Runtime-Support/issues/1984 https://github.com/airsdk/Adobe-Runtime-Support/issues/365 https://github.com/airsdk/Adobe-Runtime-Support/issues/224 https://github.com/airsdk/Adobe-Runtime-Support/issues/15
Steps to Reproduce
Launch application with code below with any Linux under sudo:
sudo -E ./linux_audiodevicemanager_sound_root_bug
Note: parameter-E
mandatory cause https://github.com/airsdk/Adobe-Runtime-Support/issues/3450 It should generate audio viaSound
.Application example with sources sample attached. linux_audiodevicemanager_sound_root_bug.zip
Actual Result: No audio played. No exceptions or errors in Scout. In terminal you will see:
Expected Result: Audio will be played.
Known Workarounds
Don't use
AudioDeviceManager.audioDeviceManager.deviceNames
.