Page 1 of 1

mplayer audio via Bluetooth Speaker problem

Posted: Wed Oct 02, 2019 11:10 am
by sparkwang
My current environment is piZeroW+debian dogLite. PI has been successfully connected to the Bluetooth speaker device and can play sound normally through the "mplayer-ao sdl" command, but to my confusion, there is no sound using the "sudo mplayer-ao sdl" command. Ask for help, thank you.

Re: mplayer audio via Bluetooth Speaker problem

Posted: Wed Oct 02, 2019 2:54 pm
by Douglas6
The root user is not a member of the 'audio' group, for one. Two, you may have made changes to the pi user's files (such as ~/.asoundrc) which the root user won't pick up. Three, I can't imagine any good reason to play audio as root. You might want to rethink that.

Re: mplayer audio via Bluetooth Speaker problem

Posted: Thu Oct 03, 2019 3:16 am
by sparkwang
HI,Douglas6,thank u very much.
1. Itry to use "sudo usermod -a -G audio root" command ,but there was still no sound.
2. As u said, I modified '/etc/asound.conf' file.
pcm.bluetooth {
type bluetooth
device my-btaddr
}
3.My current application environment is nginx+php7,I want to call 'mplayer-ao SDL ' command to play audio in PHP program. I know that the web user is www-data, and also add the www-data user to the audio and Bluetooth user groups, but there is no sound.
Looking forward to your advice,tks agin.

Re: mplayer audio via Bluetooth Speaker problem

Posted: Thu Oct 03, 2019 3:49 am
by sparkwang
Previously, in order to be able to modify the / etc/asound.conf file, I used the 'sudo Chmod 777/etc/asound.conf' command.
According to your prompt, I restored the original file permissions with the command 'sudo Chmod 611/etc/asound.conf'. Now I can play audio with the 'sudo mplayer-ao sdl' command, but the command "mplayer-ao sdl" is silent. So it can be judged that the problem lies in the modification of the / etc / asound. conf file.

But I still don't know how to do it in PHP programs, including reading and writing / etc / asound. conf files and calling Mplayer commands to play audio.

tks.