Fix play private videos
This commit is contained in:
@ -10,6 +10,7 @@ import android.net.Uri
|
||||
import android.os.AsyncTask
|
||||
import android.os.Bundle
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.webkit.WebChromeClient
|
||||
@ -139,7 +140,7 @@ class ReproductorActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
AsyncTask.execute {
|
||||
videoPlayback = this.clientVideo.getVideo(this.video.uuid)
|
||||
videoPlayback = this.clientVideo.getVideo(this.video.uuid, ManagerSingleton.token.token)
|
||||
// TODO: Make this configurable
|
||||
// val bufferSize = 1024 * 1024 // 1mb
|
||||
// val allocator = DefaultAllocator(true, bufferSize)
|
||||
|
@ -9,7 +9,7 @@ import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
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 con = url.openConnection() as HttpURLConnection
|
||||
|
||||
@ -17,7 +17,7 @@ open class Client {
|
||||
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
|
||||
con.setRequestProperty("Accept", "*/*")
|
||||
|
||||
if (token != "") {
|
||||
if (token !== null) {
|
||||
con.setRequestProperty("Authorization", "Bearer $token")
|
||||
}
|
||||
|
||||
|
@ -201,8 +201,8 @@ class Videos : Client() {
|
||||
return this.getVideos(start, "-likes")
|
||||
}
|
||||
|
||||
fun getVideo(uuid: String): VideoModel {
|
||||
val con = this.newCon("videos/$uuid", "GET")
|
||||
fun getVideo(uuid: String, token: String? = null): VideoModel {
|
||||
val con = this.newCon("videos/$uuid", "GET", token)
|
||||
val video = VideoModel()
|
||||
try {
|
||||
if (con.responseCode == 200) {
|
||||
|
Reference in New Issue
Block a user