sparkwang
Posts: 6
Joined: Fri Oct 05, 2018 7:59 am

mplayer audio via Bluetooth Speaker problem

Wed Oct 02, 2019 11:10 am

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.

User avatar
Douglas6
Posts: 4781
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: mplayer audio via Bluetooth Speaker problem

Wed Oct 02, 2019 2:54 pm

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.

sparkwang
Posts: 6
Joined: Fri Oct 05, 2018 7:59 am

Re: mplayer audio via Bluetooth Speaker problem

Thu Oct 03, 2019 3:16 am

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.
Last edited by sparkwang on Thu Oct 03, 2019 3:49 am, edited 1 time in total.

sparkwang
Posts: 6
Joined: Fri Oct 05, 2018 7:59 am

Re: mplayer audio via Bluetooth Speaker problem

Thu Oct 03, 2019 3:49 am

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.

Return to “Graphics, sound and multimedia”