TeamNewPipe / NewPipe

A libre lightweight streaming front-end for Android.
https://newpipe.net
GNU General Public License v3.0
31k stars 3.02k forks source link

YouTube - Network Change Freezes Playback #10097

Open locuturus opened 1 year ago

locuturus commented 1 year ago

Checklist

Affected version

0.25.1

Steps to reproduce the bug

  1. Be on mobile data
  2. start a YouTube video
  3. join a WiFi connection

Expected behavior

I expect the video to continue playing after switching from mobile data to WiFi

Actual behavior

Video buffer stops loading and the player freezes once the buffer from mobile data runs out. The player will not recover from this and newpipe must be swiped away from recents and restarted to resume watching any videos.

Interestingly if I begin playback while on WiFi I can freely switch to mobile data and back to WiFi without trouble. The problem depends on beginning playback while on mobile data.

Screenshots/Screen recordings

No response

Logs

Exception

com.google.android.exoplayer2.ExoPlaybackException: Source error
    at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:644)
    at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:616)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loopOnce(Looper.java:346)
    at android.os.Looper.loop(Looper.java:475)
    at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: java.net.UnknownHostException: Unable to resolve host "rr2---sn-uhvcpax0n5-25xe.googlevideo.com": No address associated with hostname
    at org.schabi.newpipe.player.datasource.YoutubeHttpDataSource.open(YoutubeHttpDataSource.java:389)
    at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:263)
    at com.google.android.exoplayer2.upstream.TeeDataSource.open(TeeDataSource.java:52)
    at com.google.android.exoplayer2.upstream.cache.CacheDataSource.openNextSource(CacheDataSource.java:796)
    at com.google.android.exoplayer2.upstream.cache.CacheDataSource.open(CacheDataSource.java:609)
    at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84)
    at com.google.android.exoplayer2.source.chunk.InitializationChunk.load(InitializationChunk.java:99)
    at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)
Caused by: java.net.UnknownHostException: Unable to resolve host "rr2---sn-uhvcpax0n5-25xe.googlevideo.com": No address associated with hostname
    at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
    at java.net.InetAddress.getAllByName(InetAddress.java:1152)
    at com.android.okhttp.Dns$1.lookup(Dns.java:41)
    at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:178)
    at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:144)
    at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:86)
    at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:176)
    at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
    at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
    at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
    at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
    at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:90)
    at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:30)
    at org.schabi.newpipe.player.datasource.YoutubeHttpDataSource.makeConnection(YoutubeHttpDataSource.java:704)
    at org.schabi.newpipe.player.datasource.YoutubeHttpDataSource.makeConnection(YoutubeHttpDataSource.java:548)
    at org.schabi.newpipe.player.datasource.YoutubeHttpDataSource.open(YoutubeHttpDataSource.java:383)
    ... 10 more
Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
    at libcore.io.Linux.android_getaddrinfo(Native Method)
    at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
    at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:222)
    at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
    at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
    ... 28 more


Affected Android/Custom ROM version

Android 13

Affected device model

Pixel 4a, Xperia 5 iii

Additional information

No response

opusforlife2 commented 1 year ago

Is it possible that your mobile network has IPv6 support while the Wifi network has only IPv4?

locuturus commented 1 year ago

My mobile network shows 1x IPv6 address. My home WiFi shows 1x IPv4 & 2x IPv6 addresses. I'm not sure about other WiFi spots I connect to throughout the day.

opusforlife2 commented 1 year ago

Well, does the error occur at home? Or only for those other Wifi spots?

locuturus commented 1 year ago

Any WiFi network, including my home one.

opusforlife2 commented 1 year ago

Alright, so that idea didn't pan out. Thanks for testing.

locuturus commented 1 year ago

Just tested again and playback which began on LTE also stops when switching from LTE to Ethernet. And beginning on Ethernet, then switching to LTE and/or to WiFi works without issue.

SrivatsanSenthilkumar commented 8 months ago

I also face the same issue. Going from wifi to mobile data works fine.

SrivatsanSenthilkumar commented 8 months ago

Relevant logs

Exception

com.google.android.exoplayer2.ExoPlaybackException: Source error
    at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:644)
    at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:616)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: java.net.UnknownHostException: Unable to resolve host "rr4---sn-gwpa-o5bez.googlevideo.com": No address associated with hostname
    at org.schabi.newpipe.player.datasource.YoutubeHttpDataSource.open(YoutubeHttpDataSource.java:389)
    at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:263)
    at com.google.android.exoplayer2.upstream.TeeDataSource.open(TeeDataSource.java:52)
    at com.google.android.exoplayer2.upstream.cache.CacheDataSource.openNextSource(CacheDataSource.java:796)
    at com.google.android.exoplayer2.upstream.cache.CacheDataSource.open(CacheDataSource.java:609)
    at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84)
    at com.google.android.exoplayer2.source.chunk.InitializationChunk.load(InitializationChunk.java:99)
    at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)
Caused by: java.net.UnknownHostException: Unable to resolve host "rr4---sn-gwpa-o5bez.googlevideo.com": No address associated with hostname
    at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
    at java.net.InetAddress.getAllByName(InetAddress.java:1152)
    at com.android.okhttp.Dns$1.lookup(Dns.java:41)
    at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:178)
    at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:144)
    at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:86)
    at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:176)
    at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
    at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
    at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
    at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
    at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:90)
    at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:30)
    at org.schabi.newpipe.player.datasource.YoutubeHttpDataSource.makeConnection(YoutubeHttpDataSource.java:704)
    at org.schabi.newpipe.player.datasource.YoutubeHttpDataSource.makeConnection(YoutubeHttpDataSource.java:548)
    at org.schabi.newpipe.player.datasource.YoutubeHttpDataSource.open(YoutubeHttpDataSource.java:383)
    ... 10 more
Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
    at libcore.io.Linux.android_getaddrinfo(Native Method)
    at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
    at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:222)
    at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
    at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
    ... 28 more


karolkozik1 commented 2 months ago

I've encountered this error as well. Interestingly, it occurs not only when switching from WiFi to mobile data (5G), but also when the mobile data changes technology based on reception, e.g. from 5G to 4G, and to HSPA+.

SrivatsanSenthilkumar commented 2 months ago

I've encountered this error as well. Interestingly, it occurs not only when switching from WiFi to mobile data (5G), but also when the mobile data changes technology based on reception, e.g. from 5G to 4G, and to HSPA+.

Does it occur when going from wifi to 5G or 5G to wifi or both?

locuturus commented 2 months ago

I recently noticed that if I'm using a VPN (Private Internet Access) I can avoid the network switching issue. However any instability in the VPN connection (say, from switching networks) is likely to crash playback via a different bug so I don't recommend this as a workaround.

dm17 commented 1 month ago

This has been the same for me for at least two years. So often I start a background YT for a song and leave the house, network switches to cell, and newpipe crashes. The annoying part is I need to go into settings and force quit it because it takes some tries to before it'll play again and that seems quickest. I also don't understand why they never get cached no matter how many times you play them. Network needs to be active or playback stops very quickly.