手机作为蓝牙音频源连接到Linux时,如何通过音量键调节传入的音量大小

背景一:
我们知道,把手机作为音频源通过蓝牙连接到电脑,就可以把手机的声音转移到电脑上。
背景二:
我喜欢带着耳机用我的Linux本刷youtube,也喜欢用我的iPhone听音乐。为了同时做这两件事,我经常使用背景一提到的方法。

但是我发现一个问题:
手机蓝牙传入的音量始终是固定的,不能通过手机的音量键控制。而且声音往往太大,盖过了电脑视频的音量。

如何解决这个问题呢?
很简单:运行 bluetoothd 的时候加上 --plugin=a2dp 的参数。

具体步骤如下:

sudo vim /lib/systemd/system/bluetooth.service

append --plugin=a2dp to the following line

ExecStart=/usr/lib/bluetooth/bluetoothd

Then it will looks like this:

ExecStart=/usr/lib/bluetooth/bluetoothd --plugin=a2dp --compat

for Debian / Raspbian Stretch users, maybe you'll also need to add --noplugin=sap:

ExecStart=/usr/lib/bluetooth/bluetoothd --plugin=a2dp --compat --noplugin=sap

Then:

sudo systemctl daemon-reload
sudo systemctl restart bluetooth

Now you're able to control the music volume passed into your laptop using the volume buttons of your iPhone.

https://askubuntu.com/questions/997553/ubuntu-18-04-17-10-pulseaudio-bluetooth-ios-volume-control
https://github.com/hadess/CHIP-bluetooth-speaker/issues/8

原文地址:https://www.cnblogs.com/dylanchu/p/11048353.html