save location

This commit is contained in:
LagradOst 2023-11-02 22:08:41 +01:00
parent fca8a55e05
commit bef34c33e9
3 changed files with 6 additions and 3 deletions

View file

@ -265,9 +265,11 @@ abstract class AbstractPlayerFragment(
context?.getString(R.string.no_links_found_toast) + "\n" + message, context?.getString(R.string.no_links_found_toast) + "\n" + message,
Toast.LENGTH_LONG Toast.LENGTH_LONG
) )
activity?.runOnUiThread {
activity?.popCurrentPage() activity?.popCurrentPage()
} }
} }
}
val ctx = context ?: return val ctx = context ?: return
when (exception) { when (exception) {

View file

@ -1396,7 +1396,7 @@ class CS3IPlayer : IPlayer {
|| error.errorCode == PlaybackException.ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED || error.errorCode == PlaybackException.ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED
|| error.errorCode == PlaybackException.ERROR_CODE_IO_UNSPECIFIED || error.errorCode == PlaybackException.ERROR_CODE_IO_UNSPECIFIED
) -> { ) -> {
val position = exoPlayer?.currentPosition ?: 0L
val gid = DownloadListener.sessionIdToGid[aria2cRequestId] val gid = DownloadListener.sessionIdToGid[aria2cRequestId]
Log.i(TAG, "Aria2 error $error error ${error.errorCode}") Log.i(TAG, "Aria2 error $error error ${error.errorCode}")
if(gid == null) { if(gid == null) {
@ -1432,6 +1432,7 @@ class CS3IPlayer : IPlayer {
// shitty solution to release it every time, however we will get timeout otherwise // shitty solution to release it every time, however we will get timeout otherwise
CommonActivity.activity?.let { act -> CommonActivity.activity?.let { act ->
try { try {
playbackPosition = position
awaitAria2c(act, loadedLink, aria2cRequestId) awaitAria2c(act, loadedLink, aria2cRequestId)
} catch (t : Throwable) { } catch (t : Throwable) {
event(ErrorEvent(t)) event(ErrorEvent(t))

View file

@ -278,7 +278,7 @@ enum class ExtractorLinkType {
} }
private fun inferTypeFromUrl(url: String): ExtractorLinkType { private fun inferTypeFromUrl(url: String): ExtractorLinkType {
val path = normalSafeApiCall { URL(url).path } val path = try { URL(url).path } catch (_ : Throwable) { null }
return when { return when {
path?.endsWith(".m3u8") == true || path?.endsWith(".m3u") == true -> ExtractorLinkType.M3U8 path?.endsWith(".m3u8") == true || path?.endsWith(".m3u") == true -> ExtractorLinkType.M3U8
path?.endsWith(".mpd") == true -> ExtractorLinkType.DASH path?.endsWith(".mpd") == true -> ExtractorLinkType.DASH