Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

cron - Raspberry Pi can't use Bluetooth speaker when playing sound from crontab

I have run a timed task on my Raspberry Pi 4 using crontab to play local audio files.

00 20 * * * ~/Documents/mp3.py

It does work, and the music plays automatically in the background when the time comes.

The problem is that when music is played, the sound comes out of the HDMI speaker, not the Bluetooth speaker. The Bluetooth speaker is connected and working, and when I run this Python code in VS Code and Terminal, the sound is played through the Bluetooth speaker.

I did some reading and added the following to the crontab:

XDG_RUNTIME_DIR=/run/user/user_id

But it didn't work, when the crontab command was launched, there was still no sound from the Bluetooth speaker.

I don't know what else I can try.

question from:https://stackoverflow.com/questions/65913289/raspberry-pi-cant-use-bluetooth-speaker-when-playing-sound-from-crontab

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...