From 0b4770188c2bce0a47e7b5ba5fa0cbaa96f2235b Mon Sep 17 00:00:00 2001 From: Koen J Date: Thu, 29 Aug 2024 17:57:55 +0200 Subject: [PATCH] Better error --- .../com/futo/platformplayer/downloads/VideoDownload.kt | 7 ++++++- .../com/futo/platformplayer/services/DownloadService.kt | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/downloads/VideoDownload.kt b/app/src/main/java/com/futo/platformplayer/downloads/VideoDownload.kt index 7de33363..1b249a74 100644 --- a/app/src/main/java/com/futo/platformplayer/downloads/VideoDownload.kt +++ b/app/src/main/java/com/futo/platformplayer/downloads/VideoDownload.kt @@ -706,7 +706,12 @@ class VideoDownload { } else { Logger.i(TAG, "Download $name Sequential"); - sourceLength = downloadSource_Sequential(client, fileStream, videoUrl, onProgress); + try { + sourceLength = downloadSource_Sequential(client, fileStream, videoUrl, onProgress); + } catch (e: Throwable) { + Logger.w(TAG, "Failed to download sequentially (url = $videoUrl)") + throw e + } } Logger.i(TAG, "$name downloadSource Finished"); diff --git a/app/src/main/java/com/futo/platformplayer/services/DownloadService.kt b/app/src/main/java/com/futo/platformplayer/services/DownloadService.kt index 39fc5562..e943cecd 100644 --- a/app/src/main/java/com/futo/platformplayer/services/DownloadService.kt +++ b/app/src/main/java/com/futo/platformplayer/services/DownloadService.kt @@ -51,8 +51,8 @@ class DownloadService : Service() { private val _client = ManagedHttpClient(OkHttpClient.Builder() //.proxy(Proxy(Proxy.Type.HTTP, InetSocketAddress(InetAddress.getByName("192.168.1.175"), 8081))) - .readTimeout(Duration.ofSeconds(30)) - .writeTimeout(Duration.ofSeconds(30)) + .readTimeout(Duration.ofMinutes(30)) + .writeTimeout(Duration.ofMinutes(30)) .connectTimeout(Duration.ofSeconds(30)) .callTimeout(Duration.ofMinutes(30)))