mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
fix
This commit is contained in:
parent
c60852794f
commit
bb9ab80d8a
3 changed files with 20 additions and 25 deletions
|
@ -98,6 +98,7 @@ object DownloadButtonSetup {
|
|||
R.id.global_to_navigation_player, PlayerFragment.newInstance(
|
||||
UriData(
|
||||
info.path.toString(),
|
||||
keyInfo.basePath,
|
||||
keyInfo.relativePath,
|
||||
keyInfo.displayName,
|
||||
click.data.parentId,
|
||||
|
|
|
@ -78,7 +78,6 @@ import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.getAu
|
|||
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.getCurrentSavedStyle
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.getFocusRequest
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.getVideoContentUri
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.isCastApiAvailable
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.onAudioFocusEvent
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.requestLocalAudioFocus
|
||||
|
@ -108,6 +107,7 @@ import kotlin.math.abs
|
|||
import kotlin.math.ceil
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
|
||||
//http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
|
||||
const val STATE_RESUME_WINDOW = "resumeWindow"
|
||||
const val STATE_RESUME_POSITION = "resumePosition"
|
||||
|
@ -158,6 +158,7 @@ data class PlayerData(
|
|||
|
||||
data class UriData(
|
||||
val uri: String,
|
||||
val basePath: String?,
|
||||
val relativePath: String,
|
||||
val displayName: String,
|
||||
val parentId: Int?,
|
||||
|
@ -1608,7 +1609,7 @@ class PlayerFragment : Fragment() {
|
|||
if (isDownloadedFile) {
|
||||
if (!supportsDownloadedFiles) return null
|
||||
val list = ArrayList<SubtitleFile>()
|
||||
VideoDownloadManager.getFolder(this, uriData.relativePath)?.forEach { file ->
|
||||
VideoDownloadManager.getFolder(this, uriData.relativePath, uriData.basePath)?.forEach { file ->
|
||||
val name = uriData.displayName.removeSuffix(".mp4")
|
||||
if (file.first != uriData.displayName && file.first.startsWith(name)) {
|
||||
val realName = file.first.removePrefix(name)
|
||||
|
@ -1882,15 +1883,7 @@ class PlayerFragment : Fragment() {
|
|||
mediaItemBuilder.setUri(currentUrl.url)
|
||||
} else if (trueUri != null || uri != null) {
|
||||
val uriPrimary = trueUri ?: Uri.parse(uri)
|
||||
if (uriPrimary.scheme == "content") {
|
||||
mediaItemBuilder.setUri(uriPrimary)
|
||||
// video_title?.text = uriPrimary.toString()
|
||||
} else {
|
||||
//mediaItemBuilder.setUri(Uri.parse(currentUrl.url))
|
||||
val realUri = trueUri ?: getVideoContentUri(requireContext(), uri ?: uriPrimary.path ?: "")
|
||||
// video_title?.text = uri.toString()
|
||||
mediaItemBuilder.setUri(realUri)
|
||||
}
|
||||
}
|
||||
|
||||
val subs = context?.getSubs() ?: emptyList()
|
||||
|
@ -2214,7 +2207,8 @@ class PlayerFragment : Fragment() {
|
|||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun initPlayer() {
|
||||
if (isDownloadedFile) {
|
||||
initPlayer(null, uriData.uri.removePrefix("file://").replace("%20", " ")) // FIX FILE PERMISSION
|
||||
//.removePrefix("file://").replace("%20", " ") // FIX FILE PERMISSION
|
||||
initPlayer(null, uriData.uri)
|
||||
}
|
||||
println("INIT PLAYER")
|
||||
view?.setOnTouchListener { _, _ -> return@setOnTouchListener true } // VERY IMPORTANT https://stackoverflow.com/questions/28818926/prevent-clicking-on-a-button-in-an-activity-while-showing-a-fragment
|
||||
|
|
|
@ -5,13 +5,11 @@ import android.app.NotificationChannel
|
|||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
import android.content.*
|
||||
import android.database.Cursor
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.provider.MediaStore
|
||||
import android.provider.OpenableColumns
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.app.NotificationCompat
|
||||
|
@ -23,7 +21,6 @@ import androidx.work.ExistingWorkPolicy
|
|||
import androidx.work.OneTimeWorkRequest
|
||||
import androidx.work.WorkManager
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.google.android.exoplayer2.util.UriUtil
|
||||
import com.hippo.unifile.UniFile
|
||||
import com.lagradost.cloudstream3.MainActivity
|
||||
import com.lagradost.cloudstream3.R
|
||||
|
@ -39,7 +36,10 @@ import kotlinx.coroutines.Dispatchers
|
|||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.withContext
|
||||
import okhttp3.internal.closeQuietly
|
||||
import java.io.*
|
||||
import java.io.BufferedInputStream
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
import java.lang.Thread.sleep
|
||||
import java.net.URI
|
||||
import java.net.URL
|
||||
|
@ -450,8 +450,8 @@ object VideoDownloadManager {
|
|||
* Used for getting video player subs.
|
||||
* @return List of pairs for the files in this format: <Name, Uri>
|
||||
* */
|
||||
fun getFolder(context: Context, relativePath: String): List<Pair<String, Uri>>? {
|
||||
val base = context.getBasePath().first
|
||||
fun getFolder(context: Context, relativePath: String, basePath: String?): List<Pair<String, Uri>>? {
|
||||
val base = basePathToFile(context, basePath)
|
||||
val folder = base?.gotoDir(relativePath, false)
|
||||
|
||||
if (isScopedStorage && base.isDownloadDir()) {
|
||||
|
|
Loading…
Reference in a new issue