mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-29 17:49:03 +03:00
fix playing local anime source videos
This commit is contained in:
parent
e60bd4d07d
commit
faa5e0b403
1 changed files with 6 additions and 13 deletions
|
@ -726,8 +726,7 @@ class PlayerActivity :
|
||||||
}
|
}
|
||||||
subTracks = arrayOf(Track("nothing", "Off")) + it.subtitleTracks.toTypedArray()
|
subTracks = arrayOf(Track("nothing", "Off")) + it.subtitleTracks.toTypedArray()
|
||||||
audioTracks = arrayOf(Track("nothing", "Off")) + it.audioTracks.toTypedArray()
|
audioTracks = arrayOf(Track("nothing", "Off")) + it.audioTracks.toTypedArray()
|
||||||
val videoUrlString = resolveUri(Uri.parse(it.videoUrl))
|
MPVLib.command(arrayOf("loadfile", parseVideoUrl(it.videoUrl)))
|
||||||
MPVLib.command(arrayOf("loadfile", videoUrlString))
|
|
||||||
}
|
}
|
||||||
launchUI { refreshUi() }
|
launchUI { refreshUi() }
|
||||||
}
|
}
|
||||||
|
@ -962,24 +961,18 @@ class PlayerActivity :
|
||||||
setViewMode()
|
setViewMode()
|
||||||
subTracks = arrayOf(Track("nothing", "Off")) + it.subtitleTracks.toTypedArray()
|
subTracks = arrayOf(Track("nothing", "Off")) + it.subtitleTracks.toTypedArray()
|
||||||
audioTracks = arrayOf(Track("nothing", "Off")) + it.audioTracks.toTypedArray()
|
audioTracks = arrayOf(Track("nothing", "Off")) + it.audioTracks.toTypedArray()
|
||||||
val videoUrlString = resolveUri(Uri.parse(it.videoUrl))
|
MPVLib.command(arrayOf("loadfile", parseVideoUrl(it.videoUrl)))
|
||||||
MPVLib.command(arrayOf("loadfile", videoUrlString))
|
|
||||||
}
|
}
|
||||||
launchUI { refreshUi() }
|
launchUI { refreshUi() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resolveUri(data: Uri): String {
|
private fun parseVideoUrl(videoUrl: String?): String? {
|
||||||
val filepath = when (data.scheme) {
|
val uri = Uri.parse(videoUrl)
|
||||||
"file" -> data.path
|
return openContentFd(uri) ?: videoUrl
|
||||||
"content" -> openContentFd(data)
|
|
||||||
"http", "https", "rtmp", "rtmps", "rtp", "rtsp", "mms", "mmst", "mmsh", "tcp", "udp",
|
|
||||||
-> data.toString()
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
return filepath ?: return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openContentFd(uri: Uri): String? {
|
private fun openContentFd(uri: Uri): String? {
|
||||||
|
if (uri.scheme != "content") return null
|
||||||
val resolver = applicationContext.contentResolver
|
val resolver = applicationContext.contentResolver
|
||||||
logcat { "Resolving content URI: $uri" }
|
logcat { "Resolving content URI: $uri" }
|
||||||
val fd = try {
|
val fd = try {
|
||||||
|
|
Loading…
Reference in a new issue