I have a Python 3.7 'media player' project on a headless Raspberry Pi Zero. Using specific hardware interface (buttons, dials), user can select the media to play (from files stored on the local drive, Internet radio stations or Youtube videos). There's no display, only audio output.
Currently I am running the VLC player by calling shell script that runs cvlc:
$ cvlc -q "path-to-media" vlc://quit &
This approach works fine, also for Youtube URLs. Of course, time to time one needs to update the youtube.luac script, to adapt for the changes that have been implemented on the site.
But there is no way of fine-controlling the player. No way to paus, and when I want to stop the playback, I just brutally kill the player process. That's not nice. So, I wanted to implement the media playback through VLC Python bindings. Unfortunately, the Youtube playback fails with "lua stream error: Found 109-character scrambled signature for youtube video URL, attempting to descramble..." error.
Here's my example code I am running in the Python console:
Code: Select all
import vlc
p = vlc.MediaPlayer('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
p.play()
If this would be the problem with youtube.luac script, then also the shell script version would fail to play, wouldn't it? But it works fine, albeit with heavy stutter that disappears after about 10 seconds (I hope to find a way how to get rid of this via the VLC Python bindings). I have the latest version of the youtube.luac script anyway.