随身wifi通过蓝牙连接蓝牙耳机并播放音乐
随身wifi通过蓝牙连接蓝牙耳机并播放音乐
1.使用的固件和随身wifi版本
固件:
https://www.123pan.com/s/gYcrVv-Nv8Xv
随身wifi版本:
UFI001c_mb_v01
2. 执行命令安装相关软件包
更新软件包
sudo apt-get update |
如遇问题看下边链接:
https://blog.csdn.net/weixin_56382610/article/details/129916885
sudo apt install bluez bluez-firmware bluetooth pulseaudio pulseaudio-module-bluetooth |
3. 修改下面的文件(使用vi或vim工具)
- 在**/etc/pulse/system.pa**文件末尾加上下面内容:
### fix bug: a2dp-sink profile connect failed [...]: Protocol not available |
- 在**/etc/pulse/default.pa**文件末尾加上下面内容:
### Automatically switch to newly-connected devices |
- 在**/etc/pulse/client.conf**文件末尾加上下面内容
;autospawn = no |
- 修改**/etc/pulse/daemon.conf**文件
把 ;exit-idle-time = 20 |
4. 重启随身wifi
reboot |
5. 使用下面命令启动pulseaudio 服务
sudo pulseaudio -k |
如遇问题:https://zhuanlan.zhihu.com/p/143388819
6. 使用下面命令连接蓝牙耳机
打开蓝牙工具sudo bluetoothctl |
输入devices查看可用蓝牙列表,看是否有要连接的蓝牙耳机 |
7. 连接成功后另开一个终端通过mplayer循环播放音乐
查看本地音乐 |
8. 输入quit退出bluetoothctl软件
9. 其他
参考文档
https://link.zhihu.com/?target=https%3A//wiki.debian.org/BluetoothUser/a2dp
https://www.freesion.com/article/9058979042/
https://zhuanlan.zhihu.com/p/512252663
https://zhuanlan.zhihu.com/p/143388819
https://blog.csdn.net/weixin_56382610/article/details/129916885
调试工具
使用sudo btmon 命令查看蓝牙log,可以快速定位到错误位置
声音大小
使用sudo alsamixer可以修改声音大小
权限问题
本实例使用了sudo,用户可以考虑把bluetooh权限加到pi用户下,测试下pi用户工作情况。
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 九怀!