From a1c3d98942fd46da9466494e6749caa8e45da7c3 Mon Sep 17 00:00:00 2001 From: fgmitesh Date: Sun, 14 Jun 2026 14:46:18 +0530 Subject: [PATCH 1/3] Document IPv6 issues for Android TV in DohProviders.kt Added comments to explain IPv6 handling for Android TV. --- .../java/com/lagradost/cloudstream3/network/DohProviders.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/lagradost/cloudstream3/network/DohProviders.kt b/app/src/main/java/com/lagradost/cloudstream3/network/DohProviders.kt index 4127799e8f4..00e91380c06 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/network/DohProviders.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/network/DohProviders.kt @@ -17,6 +17,11 @@ fun OkHttpClient.Builder.addGenericDns(url: String, ips: List) = dns( .bootstrapDnsHosts( ips.map { InetAddress.getByName(it) } ) + // Android TV often has a broken IPv6 stack — connections time out + // silently, causing ExoPlayer errors 2004/2001 on TV while the same + // stream works fine on mobile (same Wi-Fi). Force IPv4-only so OkHttp + // never attempts the broken IPv6 path. + .includeIPv6(false) .build() ) From e650fe4212a772c32bc24d2140e5f05ed1fa5374 Mon Sep 17 00:00:00 2001 From: fgmitesh Date: Sun, 14 Jun 2026 14:47:13 +0530 Subject: [PATCH 2/3] Increase OkHttpClient timeout settings Increased timeout settings for OkHttpClient to accommodate slower network stacks. --- .../com/lagradost/cloudstream3/network/RequestsHelper.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/network/RequestsHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/network/RequestsHelper.kt index 6234297d080..3641af10185 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/network/RequestsHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/network/RequestsHelper.kt @@ -43,6 +43,11 @@ fun buildDefaultClient(context: Context, ignoreSSL: Boolean = false): OkHttpClie val baseClient = OkHttpClient.Builder() .followRedirects(true) .followSslRedirects(true) + // Explicit timeouts — OkHttp defaults (10 s) are too short for TV + // network stacks which can be slower than phones on the same Wi-Fi. + .connectTimeout(30, java.util.concurrent.TimeUnit.SECONDS) + .readTimeout(30, java.util.concurrent.TimeUnit.SECONDS) + .writeTimeout(30, java.util.concurrent.TimeUnit.SECONDS) .apply { if (ignoreSSL) { ignoreAllSSLErrors() @@ -89,4 +94,4 @@ fun getHeaders( }) else mapOf() val tempHeaders = (DEFAULT_HEADERS + headers + cookieMap) return tempHeaders.toHeaders() -} \ No newline at end of file +} From 9bbd0822e0781df21571b8524142dc4597d7a34e Mon Sep 17 00:00:00 2001 From: fgmitesh Date: Sun, 14 Jun 2026 14:48:31 +0530 Subject: [PATCH 3/3] Increase CRONET timeout to 30 seconds Increased CRONET timeout to 30 seconds to accommodate slower TV network stacks. --- .../java/com/lagradost/cloudstream3/ui/player/CS3IPlayer.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/CS3IPlayer.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/CS3IPlayer.kt index d7e10c81441..9d69ac62310 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/CS3IPlayer.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/CS3IPlayer.kt @@ -658,7 +658,9 @@ class CS3IPlayer : IPlayer { } companion object { - private const val CRONET_TIMEOUT_MS = 15_000 + // 30 s instead of 15 s: TV network stacks are slower than phones + // and were timing out before the stream could start (error 2004/2001). + private const val CRONET_TIMEOUT_MS = 30_000 /** * Single shared engine, to minimize the overhead of maintaining many as: