Airpods pro连mac,音量自动重置到50%导致音量爆炸问题

  • Airpods pro 3每次连mac,音量自动重置到50%导致音量爆炸问题

  • 搜了一圈,这bug不限于iphone、Airpods全系列、第三方耳机,而且是陈年老bug

  • 一个解决方案:Mac上安装HammerSpoon,在config文件里增加以下脚本,耳机连接时自动调整音量为15,断开时调整为0,配置后reload config使脚本生效

lastOutputDeviceName
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local function handleDeviceChanges()
local currentDevice = hs.audiodevice.defaultOutputDevice()
local currentOutputDeviceName = currentDevice and currentDevice:name()

if currentOutputDeviceName == nil or lastOutputDeviceName == nil then
return
end

if lastOutputDeviceName ~= currentOutputDeviceName then
if string.find(currentOutputDeviceName, "xxx的AirPods Pro") then
currentDevice:setVolume(15)
hs.alert.show("🎧 AirPods音量设为 15")
elseif string.find(lastOutputDeviceName, "xxx的AirPods Pro") then
currentDevice:setVolume(0)
hs.alert.show("🎧 AirPods音量设为 0")
end
lastOutputDeviceName = currentOutputDeviceName
end
end

hs.audiodevice.watcher.setCallback(handleDeviceChanges)
hs.audiodevice.watcher.start()