I'm working on a Voice Assistant based on the Raspberry Pi (2 B+), and one of the functions I was looking to integrate was to play my playlist whenever I want it to.
I tried out using youtube-dl and mplayer within os.system like so, inspired by this answer
youtube-dl --playlist-random -o - "https://www.youtube.com/playlist?list=PLFepKcct_CJG0mu-nb-HvQ52FRKTEO6hT" | mplayer -
I understand that youtube-dl will download the video and send the stream piped to mplayer which will play the music.
What is happening is that the code is playing the first video flawlessly, but as soon as the video ends, mplayer just stops at whatever was the last frame. It's not continuing to the next video even though I can see youtube-dl is to downloading videos in the playlist.
Is there any way I can play multiple songs in a playlist using youtube-dl seamlessly?
You can try
omxplayerinstead... try this small sh script with named pipe firstmkfifo /home/midia/omxfifothen save this script belowscript.shandchmod +x:call the script like this: