mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-26 06:43:45 +03:00
fix mime types again
This commit is contained in:
parent
55bb3dc2b7
commit
18b1a0b87c
2 changed files with 13 additions and 6 deletions
|
@ -16,7 +16,6 @@ import android.view.MenuInflater
|
|||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.MimeTypeMap
|
||||
import androidx.annotation.FloatRange
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.view.ActionMode
|
||||
|
@ -1107,8 +1106,12 @@ class AnimeController :
|
|||
}
|
||||
|
||||
private fun getMime(uri: Uri): String {
|
||||
val extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString())
|
||||
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension) ?: MimeTypes.VIDEO_MP4
|
||||
return when (uri.path?.substringAfterLast(".")) {
|
||||
"mp4" -> MimeTypes.VIDEO_MP4
|
||||
"mkv" -> MimeTypes.APPLICATION_MATROSKA
|
||||
"m3u8" -> MimeTypes.APPLICATION_M3U8
|
||||
else -> MimeTypes.VIDEO_MP4
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemClick(view: View?, position: Int): Boolean {
|
||||
|
|
|
@ -5,11 +5,11 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Configuration
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.View
|
||||
import android.webkit.MimeTypeMap
|
||||
import android.webkit.WebSettings
|
||||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
|
@ -256,8 +256,12 @@ class PlayerActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
private fun getMime(uri: String): String {
|
||||
val extension = MimeTypeMap.getFileExtensionFromUrl(uri)
|
||||
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension) ?: MimeTypes.VIDEO_MP4
|
||||
return when (Uri.parse(uri).path?.substringAfterLast(".")) {
|
||||
"mp4" -> MimeTypes.VIDEO_MP4
|
||||
"mkv" -> MimeTypes.APPLICATION_MATROSKA
|
||||
"m3u8" -> MimeTypes.APPLICATION_M3U8
|
||||
else -> MimeTypes.VIDEO_MP4
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
|
|
Loading…
Reference in a new issue