Skip to content

Commit

Permalink
feat(*): implement calls to /session endpoint for private live stream
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Feb 29, 2024
1 parent a33192f commit 1102809
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class ApiVideoMediaFactory(
} else {
RequestManager.getSessionToken(
videoOptions.sessionTokenUrl,
videoOptions.videoType,
{
xTokenSession = it
onSuccess(PlayerMediaRequest(uri, xTokenSession))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ data class VideoOptions(
internal val sessionTokenUrl = if (videoType == VideoType.VOD) {
"$vodUrl/session"
} else {
hlsManifestUrl // Temp: return the same url as hlsManifestUrl for live
"$liveUrl/session"
}

/**
Expand Down
14 changes: 1 addition & 13 deletions player/src/main/java/video/api/player/utils/RequestManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.android.volley.toolbox.BasicNetwork
import com.android.volley.toolbox.HurlStack
import com.android.volley.toolbox.ImageRequest
import com.android.volley.toolbox.NoCache
import video.api.player.models.PlayerJsonRequest
import video.api.player.models.SessionTokenRequest
import video.api.player.models.VideoType

Expand All @@ -17,11 +16,10 @@ object RequestManager {

fun getSessionToken(
url: String,
videoType: VideoType,
onSuccess: (String?) -> Unit,
onError: (Exception) -> Unit
) {
val sessionTokenRequest = if (videoType == VideoType.VOD) {
val sessionTokenRequest =
SessionTokenRequest(url,
{ sessionTokenResult ->
onSuccess(sessionTokenResult.sessionToken)
Expand All @@ -30,16 +28,6 @@ object RequestManager {
onError(error)
}
)
} else {
PlayerJsonRequest(url,
{ sessionTokenResult ->
onSuccess(sessionTokenResult.sessionToken)
},
{ error ->
onError(error)
}
)
}

queue.add(sessionTokenRequest)
}
Expand Down

0 comments on commit 1102809

Please sign in to comment.