mirror of
https://github.com/mpv-player/mpv
synced 2024-12-20 22:02:59 +00:00
70802d519f
This commit adds notifications for hot plugging of devices. It also extends the old behaviour of the `audio-out-detected-device` property which is now backed by the hotplugging code. This allows clients to be notified when the actual audio output device changes. Maybe hotplugging should be supported for ao_coreaudio_exclusive too, but it's device selection code is a bit fragile.
14 lines
415 B
Lua
14 lines
415 B
Lua
local utils = require("mp.utils")
|
|
|
|
mp.observe_property("audio-device-list", "native", function(name, val)
|
|
print("Audio device list changed:")
|
|
for index, e in ipairs(val) do
|
|
print(" - '" .. e.name .. "' (" .. e.description .. ")")
|
|
end
|
|
end)
|
|
|
|
mp.observe_property("audio-out-detected-device", "native", function(name, val)
|
|
print("Detected audio device changed:")
|
|
print(" - '" .. val)
|
|
end)
|