From da6eef905cb99c329f56e6213c1148f83bf4425a Mon Sep 17 00:00:00 2001 From: Kai DeLorenzo Date: Fri, 5 Jul 2024 11:48:35 -0500 Subject: [PATCH] hide unable to resolve host exceptions when there are more videos in a playlist --- .../mainactivity/main/VideoDetailView.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt index 41d94a82..ab7163f1 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt @@ -1250,7 +1250,7 @@ class VideoDetailView : ConstraintLayout { } catch(ex: Throwable) { Logger.e(TAG, "Playback tracker failed", ex); - if(me.video?.isLive == true) withContext(Dispatchers.Main) { + if(me.video?.isLive == true || ex.message?.contains("Unable to resolve host") == true) withContext(Dispatchers.Main) { UIDialogs.toast(context, context.getString(R.string.failed_to_get_playback_tracker)); }; else withContext(Dispatchers.Main) { @@ -2546,13 +2546,15 @@ class VideoDetailView : ConstraintLayout { .exception { Logger.w(ChannelFragment.TAG, "Failed to load video.", it); - handleErrorOrCall { - _retryCount = 0; - _retryJob?.cancel(); - _retryJob = null; - _liveTryJob?.cancel(); - _liveTryJob = null; - UIDialogs.showGeneralRetryErrorDialog(context, context.getString(R.string.failed_to_load_video), it, ::fetchVideo, null, fragment); + if(!(it.message?.contains("Unable to resolve host") ?: false && nextVideo())){ + handleErrorOrCall { + _retryCount = 0; + _retryJob?.cancel(); + _retryJob = null; + _liveTryJob?.cancel(); + _liveTryJob = null; + UIDialogs.showGeneralRetryErrorDialog(context, context.getString(R.string.failed_to_load_video), it, ::fetchVideo, null, fragment); + } } } else TaskHandler(IPlatformVideoDetails::class.java, {fragment.lifecycleScope});