Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Zimit2 Youtube video still doesn't play on Android reader. #3879

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class ZimFileReader constructor(
.subscribe({ }, Throwable::printStackTrace)
}

private fun getItem(url: String): Item? =
fun getItem(url: String): Item? =
try {
val actualPath = url.toUri().filePath.decodeUrl
jniKiwixReader.getEntryByPath(actualPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ZimReaderContainer @Inject constructor(private val zimFileReaderFactory: F
val headers = mutableMapOf("Accept-Ranges" to "bytes")
if ("Range" in requestHeaders.keys) {
setStatusCodeAndReasonPhrase(HttpURLConnection.HTTP_PARTIAL, "Partial Content")
val fullSize = data?.available()?.toLong() ?: 0L
val fullSize = zimFileReader?.getItem(url)?.size ?: 0L
val lastByte = fullSize - 1
val byteRanges = requestHeaders.getValue("Range").substringAfter("=").split("-")
headers["Content-Range"] = "bytes ${byteRanges[0]}-$lastByte/$fullSize"
Expand Down
Loading