Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ fun OkHttpClient.Builder.addGenericDns(url: String, ips: List<String>) = 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()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -89,4 +94,4 @@ fun getHeaders(
}) else mapOf()
val tempHeaders = (DEFAULT_HEADERS + headers + cookieMap)
return tempHeaders.toHeaders()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down