diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt index f22d5515..619cf06c 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt @@ -265,7 +265,9 @@ abstract class AbstractPlayerFragment( context?.getString(R.string.no_links_found_toast) + "\n" + message, Toast.LENGTH_LONG ) - activity?.popCurrentPage() + activity?.runOnUiThread { + activity?.popCurrentPage() + } } } 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 f548d46d..9db65707 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 @@ -1396,7 +1396,7 @@ class CS3IPlayer : IPlayer { || error.errorCode == PlaybackException.ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED || error.errorCode == PlaybackException.ERROR_CODE_IO_UNSPECIFIED ) -> { - + val position = exoPlayer?.currentPosition ?: 0L val gid = DownloadListener.sessionIdToGid[aria2cRequestId] Log.i(TAG, "Aria2 error $error error ${error.errorCode}") if(gid == null) { @@ -1432,6 +1432,7 @@ class CS3IPlayer : IPlayer { // shitty solution to release it every time, however we will get timeout otherwise CommonActivity.activity?.let { act -> try { + playbackPosition = position awaitAria2c(act, loadedLink, aria2cRequestId) } catch (t : Throwable) { event(ErrorEvent(t)) diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index ce393c9d..6f5f90e0 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -278,7 +278,7 @@ enum class ExtractorLinkType { } private fun inferTypeFromUrl(url: String): ExtractorLinkType { - val path = normalSafeApiCall { URL(url).path } + val path = try { URL(url).path } catch (_ : Throwable) { null } return when { path?.endsWith(".m3u8") == true || path?.endsWith(".m3u") == true -> ExtractorLinkType.M3U8 path?.endsWith(".mpd") == true -> ExtractorLinkType.DASH