Fix play private videos

This commit is contained in:
Ivan Agosto
2025-02-01 18:52:47 -06:00
parent 3997b38120
commit 4738c317cc
3 changed files with 6 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ import android.net.Uri
import android.os.AsyncTask import android.os.AsyncTask
import android.os.Bundle import android.os.Bundle
import android.os.Looper import android.os.Looper
import android.util.Log
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import android.webkit.WebChromeClient import android.webkit.WebChromeClient
@@ -139,7 +140,7 @@ class ReproductorActivity : AppCompatActivity() {
} }
AsyncTask.execute { AsyncTask.execute {
videoPlayback = this.clientVideo.getVideo(this.video.uuid) videoPlayback = this.clientVideo.getVideo(this.video.uuid, ManagerSingleton.token.token)
// TODO: Make this configurable // TODO: Make this configurable
// val bufferSize = 1024 * 1024 // 1mb // val bufferSize = 1024 * 1024 // 1mb
// val allocator = DefaultAllocator(true, bufferSize) // val allocator = DefaultAllocator(true, bufferSize)

View File

@@ -9,7 +9,7 @@ import java.net.HttpURLConnection
import java.net.URL import java.net.URL
open class Client { open class Client {
protected fun newCon(uri: String, method: String, token: String = ""): HttpURLConnection { protected fun newCon(uri: String, method: String, token: String? = null): HttpURLConnection {
val url = URL("https://${ManagerSingleton.url}/api/v1/$uri") val url = URL("https://${ManagerSingleton.url}/api/v1/$uri")
val con = url.openConnection() as HttpURLConnection val con = url.openConnection() as HttpURLConnection
@@ -17,7 +17,7 @@ open class Client {
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded") con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
con.setRequestProperty("Accept", "*/*") con.setRequestProperty("Accept", "*/*")
if (token != "") { if (token !== null) {
con.setRequestProperty("Authorization", "Bearer $token") con.setRequestProperty("Authorization", "Bearer $token")
} }

View File

@@ -201,8 +201,8 @@ class Videos : Client() {
return this.getVideos(start, "-likes") return this.getVideos(start, "-likes")
} }
fun getVideo(uuid: String): VideoModel { fun getVideo(uuid: String, token: String? = null): VideoModel {
val con = this.newCon("videos/$uuid", "GET") val con = this.newCon("videos/$uuid", "GET", token)
val video = VideoModel() val video = VideoModel()
try { try {
if (con.responseCode == 200) { if (con.responseCode == 200) {