Qt6 Qml MediaDevices does not show all audio output devices
-
I have very simple player, the most relevant code is:
PlasmoidItem { id: root MediaDevices { id: mediaDevices } AudioOutput { id: audioOutput volume: 0.75 Component.onCompleted: { for (var i = 0; i < mediaDevices.audioOutputs.length; i++) { console.log("Index " + i + ": " + mediaDevices.audioOutputs[i].description) } } } MediaPlayer { id: playMusic audioOutput: audioOutput } }onCompleted prints:
qml: Index 0: Jabra Link 380 Analog Stereo qml: Index 1: Ryzen HD Audio Controller Analog StereoIn the same time, when I check devices with
pactl list sinks short:739 alsa_output.usb-0b0e_Jabra_Link_380_50C2EDC0E492-00.analog-stereo PipeWire s16le 2ch 48000Hz SUSPENDED 742 alsa_output.pci-0000_0c_00.6.analog-stereo PipeWire s32le 2ch 48000Hz SUSPENDED 994 bluez_output.98:47:44:7F:97:F0 PipeWire float32le 2ch 48000Hz SUSPENDEDAnd
pactl get-default-sink:bluez_output.98:47:44:7F:97:F0I am experiencing issues with audio output selection and routing in a Plasma plasmoid using Qt6.5+. Despite changing the default device in plasma-pa or pavucontrol, the application does not respect these settings consistently.
As you can see I have 3 audio devices available and bluetooth headphones are set as default.
-
ffmpeg
Playback is handled by the Jabra headset (if connected). When the Jabra dongle is removed from the USB port, playback switches to the speakers (line out). Regardless of which device is selected as the default in the audio mixer (plasma-pa or pavucontrol), playback always falls back to a 'some-kind-of-default' device. -
gstreamer
Playback is handled by the Jabra headset (if connected). However, if I switch the default output device in the audio mixer from Bluetooth to Jabra and then back to Bluetooth, the sounds play on the Bluetooth headphones instead. Restarting the plasmoid resets playback back to Jabra. The same issue occurs when the Jabra dongle is disconnected: playback defaults to speakers, but switching the default from Bluetooth to speakers and then back to Bluetooth routes the sounds to the Bluetooth headphones.
There are actually multiple issues. The most important one is: why doesn't
MediaDevices.audioOutputslist all audio devices? Is this a known issue?
What about not working audio device routing when using the ffmpeg backend? Is it a known issue?
And last but not least: with the gstreamer backend, playback works, but not immediately after the plasmoid starts — only after switching the default audio device back and forth. Is this a known issue?Stack:
$ kinfo --version Operating System: CachyOS Linux KDE Plasma Version: 6.5.4 KDE Frameworks Version: 6.21.0 Qt Version: 6.10.1 Kernel Version: 6.18.3-2-cachyos (64-bit) Graphics Platform: X11Qt Multimedia backend:
qt.multimedia.ffmpeg: Using Qt multimedia with FFmpeg version n8.0.1 GPL version 3 or laterVS
qt.multimedia.gstreamer: Using Qt multimedia with GStreamer version: "GStreamer 1.26.10" -