oaubert / python-vlc

Python vlc bindings
GNU Lesser General Public License v2.1
381 stars 108 forks source link

Auto fallback over to IPv4 if IPv6 is unavailable. #247

Closed rayep closed 1 year ago

rayep commented 1 year ago

Hi Team,

Hope you are doing well.

I've been using python-vlc module for playing songs by feeding song links through media_player_new method. It is perfect! :) Thank you so much for making this library available for us! 👍

Today, I've noticed some issues while streaming songs i.e., player started to print the following errors:

[0000020ea47d5ef0] gnutls tls client error: TLS handshake error: Error in the push function.
[0000020ea47d5ef0] main tls client error: TLS session handshake error
[0000020ea47d5ef0] main tls client error: connection error: Interrupted function call
[0000020ea47d5ef0] main tls client error: connection error: Interrupted function call
[0000020ea47d5ef0] main tls client error: connection error: Interrupted function call
[0000020ea47d5ef0] main tls client error: connection error: Interrupted function call
[0000020ea47d5d70] access stream error: HTTP connection failure

I took a Wireshark capture and noticed the connection to the song CDN is being attempted over IPv6 (my machine has dual stack Internet access, however, my IPv6 was having some issues) and fails to download the song since my IPv6 connection broke.

208 2023-01-15 18:57:36.317578 2407:1140:0:XXXX:YYYY:b1ff:fee3:b1fa 2407:1140:0:65d4:7596:b627:b31f:1999 ICMPv6 134 Destination Unreachable (no route to destination)

Since, my machine is dual-stacked, DNS response (AAAA) for CDN was provided by the DNS server and the library attempts to open TLS session over IPv6 which fails with ICMPv6 (no route to destination) message back from my home router (expected since IPv6 access is down). Network adapter settings shows IPv4 - Internet access, and IPv6- No Internet Access.

When I tried to download the same song from browser, it opens fine as it falls back to IPv4 automatically or uses the available network to download it.

Is it possible to configure python-vlc library to do the same? or maybe to give preference to the active network?

Thank you, Ray.

oaubert commented 1 year ago

This is more a libvlc question that should be asked on forum.videolan.org, since it does not depend on the binding. But I would say that the issue is more in your IPv6 configuration: if you ipv6 is not reliable, you should disable it to not mislead software into thinking it can be used.

rayep commented 1 year ago

@oaubert Thank you for your response.

Unfortunately, disabling IPv6 is not an option as I have resources that's available only over IPv6. On the same note, it's expected to lose internet connectivity over IPv6 sometimes (not IPv6 address assigned) when there are issues with ISP.

It'd be nice to see libvlc doing network selection just like how the web browsers do it today. I'll take this query over to VLC forum.

Thank you for your time!