fix: downloaded next not working

This commit is contained in:
rebelonion 2024-04-30 19:07:47 -05:00
parent 85835b5c2e
commit 2d2f058d27
2 changed files with 9 additions and 3 deletions

View file

@ -145,6 +145,7 @@ import ani.dantotsu.toPx
import ani.dantotsu.toast
import ani.dantotsu.tryWithSuspend
import ani.dantotsu.util.Logger
import com.anggrayudi.storage.file.extension
import com.bumptech.glide.Glide
import com.google.android.gms.cast.framework.CastButtonFactory
import com.google.android.gms.cast.framework.CastContext
@ -1504,7 +1505,12 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
}
if (docFile != null) {
val uri = docFile.uri
MediaItem.Builder().setUri(uri).setMimeType(mimeType).build()
val downloadedMimeType = when (docFile.extension) {
"mp4" -> MimeTypes.APPLICATION_MP4
"mkv" -> MimeTypes.APPLICATION_MATROSKA
else -> MimeTypes.APPLICATION_MP4
}
MediaItem.Builder().setUri(uri).setMimeType(downloadedMimeType).build()
} else {
snackString("File not found")
null

View file

@ -328,7 +328,7 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
}
dismiss()
if (launch!! || model.watchSources!!.isDownloadedSource(media.selected!!.sourceIndex)) {
if (launch!!) {
stopAddingToList()
val intent = Intent(activity, ExoplayerView::class.java)
ExoplayerView.media = media
@ -386,7 +386,7 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
}
fun performClick(position: Int) {
try { //bandaid fix for crash
try {
val extractor = links[position]
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]?.selectedExtractor =
extractor.server.name