Youtube playback fails when using Python bindings

This forum is about all development around libVLC.
Passiday
New Cone
New Cone
Posts: 5
Joined: 28 Jan 2019 20:31

Youtube playback fails when using Python bindings

Postby Passiday » 12 Aug 2019 11:25

Hello,

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()
Initially the "p.play()" returns "0" and p.is_playing() returns "1", but after short moment an error message is output, and "p.is_playing()" returns "0".

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.

Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 20 guests