mirror of
https://gitlab.com/vyla-entertainment/TV.git
synced 2026-11-16 13:07:21 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6e738c18d5
|
|||
|
2c094e254d
|
|||
|
97c45f14c2
|
|||
|
3d59612d6e
|
|||
|
bd7d443f21
|
|||
|
|
8cd9ec3671 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -8,4 +8,6 @@ android/.gradle/
|
|||||||
.env
|
.env
|
||||||
.build
|
.build
|
||||||
www/
|
www/
|
||||||
android/app/src/main/assets/
|
android/app/src/main/assets/
|
||||||
|
release/
|
||||||
|
android/app/src/main/res/raw/*.crt
|
||||||
@@ -11,7 +11,7 @@ android {
|
|||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 34
|
targetSdkVersion 34
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0.0"
|
versionName "1.0.9"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ import kotlinx.coroutines.flow.first
|
|||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
import tv.vyla.app.ui.components.VideoTintSampler
|
import tv.vyla.app.ui.components.VideoTintSampler
|
||||||
import tv.vyla.app.ui.components.videoTint
|
import tv.vyla.app.ui.components.videoTint
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
enum class ActivePlayerMenu {
|
enum class ActivePlayerMenu {
|
||||||
NONE, QUALITY, SUBTITLES, VOLUME, SETTINGS, MORE
|
NONE, QUALITY, SUBTITLES, VOLUME, SETTINGS, MORE
|
||||||
@@ -151,6 +152,7 @@ fun PlayerScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showControlsAndFocusPlay() {
|
fun showControlsAndFocusPlay() {
|
||||||
areControlsVisible = true
|
areControlsVisible = true
|
||||||
resetHideTimer()
|
resetHideTimer()
|
||||||
@@ -161,6 +163,7 @@ fun PlayerScreen(
|
|||||||
} catch (_: Exception) {}
|
} catch (_: Exception) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val exoPlayer = remember {
|
val exoPlayer = remember {
|
||||||
ExoPlayer.Builder(context).build().apply {
|
ExoPlayer.Builder(context).build().apply {
|
||||||
playWhenReady = true
|
playWhenReady = true
|
||||||
@@ -171,6 +174,7 @@ fun PlayerScreen(
|
|||||||
durationMs = duration.coerceAtLeast(0L)
|
durationMs = duration.coerceAtLeast(0L)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onIsPlayingChanged(playing: Boolean) {
|
override fun onIsPlayingChanged(playing: Boolean) {
|
||||||
isPlaying = playing
|
isPlaying = playing
|
||||||
if (playing) {
|
if (playing) {
|
||||||
@@ -224,6 +228,37 @@ fun PlayerScreen(
|
|||||||
exoPlayer.play()
|
exoPlayer.play()
|
||||||
resetHideTimer()
|
resetHideTimer()
|
||||||
}
|
}
|
||||||
|
DisposableEffect(exoPlayer) {
|
||||||
|
val errorListener = object : Player.Listener { // source auto-fallback
|
||||||
|
override fun onPlayerError(error: androidx.media3.common.PlaybackException) {
|
||||||
|
val currentIdx = resolvedStreams.indexOf(activeStream)
|
||||||
|
if (currentIdx != -1 && currentIdx + 1 < resolvedStreams.size) {
|
||||||
|
// android.widget.Toast.makeText(context, "Source failed. Trying next...", android.widget.Toast.LENGTH_SHORT).show()
|
||||||
|
Log.e("vyla", "Source failed. Trying next...")
|
||||||
|
|
||||||
|
coroutineScope.launch {
|
||||||
|
delay(1500) // follow rate limits
|
||||||
|
val nextStream = resolvedStreams[currentIdx + 1]
|
||||||
|
activeStream = nextStream
|
||||||
|
playStream(nextStream.primaryUrl, nextStream.headers)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isBuffering = false
|
||||||
|
Log.e("vyla", "All Sources Failed")
|
||||||
|
android.widget.Toast.makeText(
|
||||||
|
context,
|
||||||
|
"All available sources failed. Please disable any VPN or try again later",
|
||||||
|
android.widget.Toast.LENGTH_LONG
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exoPlayer.addListener(errorListener)
|
||||||
|
|
||||||
|
onDispose {
|
||||||
|
exoPlayer.removeListener(errorListener)
|
||||||
|
}
|
||||||
|
}
|
||||||
suspend fun focusEpisodeCard() {
|
suspend fun focusEpisodeCard() {
|
||||||
var tries = 0
|
var tries = 0
|
||||||
while (tries < 15) {
|
while (tries < 15) {
|
||||||
@@ -232,9 +267,11 @@ fun PlayerScreen(
|
|||||||
try {
|
try {
|
||||||
episodeFocusRequester.requestFocus()
|
episodeFocusRequester.requestFocus()
|
||||||
return
|
return
|
||||||
} catch (_: Exception) {}
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadSeasonEpisodes(seasonNum: Int, focusFirst: Boolean = false) {
|
fun loadSeasonEpisodes(seasonNum: Int, focusFirst: Boolean = false) {
|
||||||
selectedSeasonNum = seasonNum
|
selectedSeasonNum = seasonNum
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
@@ -300,7 +337,9 @@ fun PlayerScreen(
|
|||||||
onFirstPlayable = { stream ->
|
onFirstPlayable = { stream ->
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
activeStream = stream
|
activeStream = stream
|
||||||
resolvedStreams.add(stream)
|
if (!resolvedStreams.any { it.provider == stream.provider }) {
|
||||||
|
resolvedStreams.add(stream)
|
||||||
|
}
|
||||||
playStream(stream.primaryUrl, stream.headers)
|
playStream(stream.primaryUrl, stream.headers)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -337,26 +376,31 @@ fun PlayerScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
BackHandler {
|
BackHandler {
|
||||||
when {
|
fun closeActiveMenu() {
|
||||||
activeMenu != ActivePlayerMenu.NONE -> {
|
val closedMenu = activeMenu
|
||||||
val closedMenu = activeMenu
|
activeMenu = ActivePlayerMenu.NONE
|
||||||
activeMenu = ActivePlayerMenu.NONE
|
areControlsVisible = true
|
||||||
areControlsVisible = true
|
resetHideTimer()
|
||||||
resetHideTimer()
|
coroutineScope.launch {
|
||||||
coroutineScope.launch {
|
delay(50)
|
||||||
delay(50)
|
try {
|
||||||
try {
|
when (closedMenu) {
|
||||||
when (closedMenu) {
|
ActivePlayerMenu.QUALITY -> qualityButtonFocusRequester.requestFocus()
|
||||||
ActivePlayerMenu.QUALITY -> qualityButtonFocusRequester.requestFocus()
|
ActivePlayerMenu.SUBTITLES -> ccButtonFocusRequester.requestFocus()
|
||||||
ActivePlayerMenu.SUBTITLES -> ccButtonFocusRequester.requestFocus()
|
ActivePlayerMenu.VOLUME -> volButtonFocusRequester.requestFocus()
|
||||||
ActivePlayerMenu.VOLUME -> volButtonFocusRequester.requestFocus()
|
ActivePlayerMenu.SETTINGS -> setButtonFocusRequester.requestFocus()
|
||||||
ActivePlayerMenu.SETTINGS -> setButtonFocusRequester.requestFocus()
|
ActivePlayerMenu.MORE -> moreButtonFocusRequester.requestFocus()
|
||||||
ActivePlayerMenu.MORE -> moreButtonFocusRequester.requestFocus()
|
else -> playPauseFocusRequester.requestFocus()
|
||||||
else -> playPauseFocusRequester.requestFocus()
|
}
|
||||||
}
|
} catch (_: Exception) {
|
||||||
} catch (_: Exception) {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
when {
|
||||||
|
activeMenu != ActivePlayerMenu.NONE -> {
|
||||||
|
closeActiveMenu()
|
||||||
|
}
|
||||||
|
|
||||||
isEpisodesDrawerOpen -> {
|
isEpisodesDrawerOpen -> {
|
||||||
isEpisodesDrawerOpen = false
|
isEpisodesDrawerOpen = false
|
||||||
areControlsVisible = true
|
areControlsVisible = true
|
||||||
@@ -365,12 +409,20 @@ fun PlayerScreen(
|
|||||||
delay(50)
|
delay(50)
|
||||||
try {
|
try {
|
||||||
episodesButtonFocusRequester.requestFocus()
|
episodesButtonFocusRequester.requestFocus()
|
||||||
} catch (_: Exception) {}
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
areControlsVisible -> {
|
areControlsVisible -> {
|
||||||
|
hideControlsJob?.cancel()
|
||||||
areControlsVisible = false
|
areControlsVisible = false
|
||||||
|
try {
|
||||||
|
playerContainerFocusRequester.requestFocus()
|
||||||
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> onBack()
|
else -> onBack()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -382,6 +434,7 @@ fun PlayerScreen(
|
|||||||
idx >= 0 && (idx + 1 < allEpisodes.size || seasons.any { it.seasonNumber > ep.seasonNumber })
|
idx >= 0 && (idx + 1 < allEpisodes.size || seasons.any { it.seasonNumber > ep.seasonNumber })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun playNextEpisode() {
|
fun playNextEpisode() {
|
||||||
val ep = currentEpisode ?: return
|
val ep = currentEpisode ?: return
|
||||||
val idx = allEpisodes.indexOfFirst { it.episodeNumber == ep.episodeNumber }
|
val idx = allEpisodes.indexOfFirst { it.episodeNumber == ep.episodeNumber }
|
||||||
@@ -420,6 +473,25 @@ fun PlayerScreen(
|
|||||||
playerViewRef?.videoSurfaceView
|
playerViewRef?.videoSurfaceView
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun closeActiveMenu() {
|
||||||
|
val closedMenu = activeMenu
|
||||||
|
activeMenu = ActivePlayerMenu.NONE
|
||||||
|
resetHideTimer()
|
||||||
|
coroutineScope.launch {
|
||||||
|
delay(50)
|
||||||
|
try {
|
||||||
|
when (closedMenu) {
|
||||||
|
ActivePlayerMenu.QUALITY -> qualityButtonFocusRequester.requestFocus()
|
||||||
|
ActivePlayerMenu.SUBTITLES -> ccButtonFocusRequester.requestFocus()
|
||||||
|
ActivePlayerMenu.VOLUME -> volButtonFocusRequester.requestFocus()
|
||||||
|
ActivePlayerMenu.SETTINGS -> setButtonFocusRequester.requestFocus()
|
||||||
|
ActivePlayerMenu.MORE -> moreButtonFocusRequester.requestFocus()
|
||||||
|
else -> playPauseFocusRequester.requestFocus()
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -431,10 +503,14 @@ fun PlayerScreen(
|
|||||||
val code = event.nativeKeyEvent.keyCode
|
val code = event.nativeKeyEvent.keyCode
|
||||||
|
|
||||||
if (!areControlsVisible) {
|
if (!areControlsVisible) {
|
||||||
|
if (code == KeyEvent.KEYCODE_BACK || code == KeyEvent.KEYCODE_ESCAPE) { // defer to backhandler
|
||||||
|
return@onKeyEvent false
|
||||||
|
}
|
||||||
val pendingSegment = activeSegment
|
val pendingSegment = activeSegment
|
||||||
val isConfirm = code == KeyEvent.KEYCODE_DPAD_CENTER ||
|
val isConfirm = code == KeyEvent.KEYCODE_DPAD_CENTER ||
|
||||||
code == KeyEvent.KEYCODE_ENTER ||
|
code == KeyEvent.KEYCODE_ENTER ||
|
||||||
code == KeyEvent.KEYCODE_NUMPAD_ENTER
|
code == KeyEvent.KEYCODE_NUMPAD_ENTER
|
||||||
|
|
||||||
if (pendingSegment != null && isConfirm && activeMenu == ActivePlayerMenu.NONE && !isEpisodesDrawerOpen) {
|
if (pendingSegment != null && isConfirm && activeMenu == ActivePlayerMenu.NONE && !isEpisodesDrawerOpen) {
|
||||||
skipSegment(pendingSegment)
|
skipSegment(pendingSegment)
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
@@ -446,41 +522,70 @@ fun PlayerScreen(
|
|||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (code == KeyEvent.KEYCODE_BACK || code == KeyEvent.KEYCODE_ESCAPE) {
|
||||||
|
when {
|
||||||
|
activeMenu != ActivePlayerMenu.NONE -> {
|
||||||
|
return@onKeyEvent false // defer to backhandler
|
||||||
|
}
|
||||||
|
|
||||||
|
isEpisodesDrawerOpen -> {
|
||||||
|
return@onKeyEvent false // defer to backhandler
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> { // hide controls
|
||||||
|
|
||||||
|
hideControlsJob?.cancel()
|
||||||
|
areControlsVisible = false
|
||||||
|
try {
|
||||||
|
playerContainerFocusRequester.requestFocus()
|
||||||
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
|
return@onKeyEvent true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
when (code) {
|
when (code) {
|
||||||
KeyEvent.KEYCODE_MEDIA_PLAY -> {
|
KeyEvent.KEYCODE_MEDIA_PLAY -> {
|
||||||
exoPlayer.play()
|
exoPlayer.play()
|
||||||
showControlsAndFocusPlay()
|
showControlsAndFocusPlay()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_MEDIA_PAUSE -> {
|
KeyEvent.KEYCODE_MEDIA_PAUSE -> {
|
||||||
exoPlayer.pause()
|
exoPlayer.pause()
|
||||||
showControlsAndFocusPlay()
|
showControlsAndFocusPlay()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE -> {
|
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE -> {
|
||||||
if (exoPlayer.isPlaying) exoPlayer.pause() else exoPlayer.play()
|
if (exoPlayer.isPlaying) exoPlayer.pause() else exoPlayer.play()
|
||||||
showControlsAndFocusPlay()
|
showControlsAndFocusPlay()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_MEDIA_FAST_FORWARD -> {
|
KeyEvent.KEYCODE_MEDIA_FAST_FORWARD -> {
|
||||||
exoPlayer.seekTo((exoPlayer.currentPosition + 10000).coerceAtMost(exoPlayer.duration))
|
exoPlayer.seekTo((exoPlayer.currentPosition + 10000).coerceAtMost(exoPlayer.duration))
|
||||||
resetHideTimer()
|
resetHideTimer()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_MEDIA_REWIND -> {
|
KeyEvent.KEYCODE_MEDIA_REWIND -> {
|
||||||
exoPlayer.seekTo((exoPlayer.currentPosition - 10000).coerceAtLeast(0))
|
exoPlayer.seekTo((exoPlayer.currentPosition - 10000).coerceAtLeast(0))
|
||||||
resetHideTimer()
|
resetHideTimer()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_SPACE -> {
|
KeyEvent.KEYCODE_SPACE -> {
|
||||||
if (exoPlayer.isPlaying) exoPlayer.pause() else exoPlayer.play()
|
if (exoPlayer.isPlaying) exoPlayer.pause() else exoPlayer.play()
|
||||||
showControlsAndFocusPlay()
|
showControlsAndFocusPlay()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_BACK -> {
|
KeyEvent.KEYCODE_BACK -> {
|
||||||
resetHideTimer()
|
resetHideTimer()
|
||||||
return@onKeyEvent false
|
return@onKeyEvent false
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_CENTER -> {
|
KeyEvent.KEYCODE_DPAD_CENTER -> {
|
||||||
resetHideTimer()
|
resetHideTimer()
|
||||||
return@onKeyEvent false
|
return@onKeyEvent false
|
||||||
@@ -499,7 +604,8 @@ fun PlayerScreen(
|
|||||||
isFocusable = false
|
isFocusable = false
|
||||||
isFocusableInTouchMode = false
|
isFocusableInTouchMode = false
|
||||||
descendantFocusability = ViewGroup.FOCUS_BLOCK_DESCENDANTS
|
descendantFocusability = ViewGroup.FOCUS_BLOCK_DESCENDANTS
|
||||||
resizeMode = if (isFillScreen) AspectRatioFrameLayout.RESIZE_MODE_ZOOM else AspectRatioFrameLayout.RESIZE_MODE_FIT
|
resizeMode =
|
||||||
|
if (isFillScreen) AspectRatioFrameLayout.RESIZE_MODE_ZOOM else AspectRatioFrameLayout.RESIZE_MODE_FIT
|
||||||
layoutParams = FrameLayout.LayoutParams(
|
layoutParams = FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT
|
ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
@@ -520,7 +626,7 @@ fun PlayerScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val seg = activeSegment
|
val seg = activeSegment
|
||||||
val showNextPrompt = isNextEpAvailable && durationMs > 0 && (durationMs - currentPositionMs) in 1..300000
|
val showNextPrompt = isNextEpAvailable && durationMs > 0 && (durationMs - currentPositionMs) in 1..30000
|
||||||
if ((seg != null || showNextPrompt) && activeMenu == ActivePlayerMenu.NONE && !isEpisodesDrawerOpen) {
|
if ((seg != null || showNextPrompt) && activeMenu == ActivePlayerMenu.NONE && !isEpisodesDrawerOpen) {
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.End,
|
horizontalAlignment = Alignment.End,
|
||||||
@@ -751,7 +857,8 @@ fun PlayerScreen(
|
|||||||
onLeftPress = {
|
onLeftPress = {
|
||||||
try {
|
try {
|
||||||
seekbarFocusRequester.requestFocus()
|
seekbarFocusRequester.requestFocus()
|
||||||
} catch (_: Exception) {}
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onUpPress = {
|
onUpPress = {
|
||||||
try {
|
try {
|
||||||
@@ -770,6 +877,7 @@ fun PlayerScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (activeMenu != ActivePlayerMenu.NONE) {
|
if (activeMenu != ActivePlayerMenu.NONE) {
|
||||||
|
var menuHasFocus by remember { mutableStateOf(false) }
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.TopEnd)
|
.align(Alignment.TopEnd)
|
||||||
@@ -781,6 +889,30 @@ fun PlayerScreen(
|
|||||||
.border(1.dp, Color(0x33FFFFFF), RoundedCornerShape(18.dp))
|
.border(1.dp, Color(0x33FFFFFF), RoundedCornerShape(18.dp))
|
||||||
.padding(14.dp)
|
.padding(14.dp)
|
||||||
.zIndex(25f)
|
.zIndex(25f)
|
||||||
|
.onFocusChanged { state ->
|
||||||
|
if (menuHasFocus && !state.hasFocus) {
|
||||||
|
// Focus navigated outside the menu popup: dismiss it
|
||||||
|
activeMenu = ActivePlayerMenu.NONE
|
||||||
|
resetHideTimer()
|
||||||
|
}
|
||||||
|
menuHasFocus = state.hasFocus
|
||||||
|
}
|
||||||
|
.onKeyEvent { event ->
|
||||||
|
if (event.type == KeyEventType.KeyDown) {
|
||||||
|
when (event.nativeKeyEvent.keyCode) {
|
||||||
|
KeyEvent.KEYCODE_BACK, KeyEvent.KEYCODE_ESCAPE -> {
|
||||||
|
closeActiveMenu()
|
||||||
|
return@onKeyEvent true
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyEvent.KEYCODE_DPAD_LEFT -> {
|
||||||
|
closeActiveMenu()
|
||||||
|
return@onKeyEvent true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
LazyColumn(modifier = Modifier.fillMaxWidth()) {
|
LazyColumn(modifier = Modifier.fillMaxWidth()) {
|
||||||
when (activeMenu) {
|
when (activeMenu) {
|
||||||
@@ -816,6 +948,7 @@ fun PlayerScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivePlayerMenu.SUBTITLES -> {
|
ActivePlayerMenu.SUBTITLES -> {
|
||||||
item {
|
item {
|
||||||
MenuSectionHeader("Subtitles")
|
MenuSectionHeader("Subtitles")
|
||||||
@@ -870,7 +1003,11 @@ fun PlayerScreen(
|
|||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
modifier = Modifier.padding(horizontal = 6.dp, vertical = 4.dp)
|
modifier = Modifier.padding(horizontal = 6.dp, vertical = 4.dp)
|
||||||
) {
|
) {
|
||||||
listOf("White" to "#FFFFFF", "Yellow" to "#FFD700", "Cyan" to "#00FFFF").forEach { (name, hex) ->
|
listOf(
|
||||||
|
"White" to "#FFFFFF",
|
||||||
|
"Yellow" to "#FFD700",
|
||||||
|
"Cyan" to "#00FFFF"
|
||||||
|
).forEach { (name, hex) ->
|
||||||
MiniSelectButton(
|
MiniSelectButton(
|
||||||
text = name,
|
text = name,
|
||||||
isSelected = subtitleColorHex == hex,
|
isSelected = subtitleColorHex == hex,
|
||||||
@@ -880,6 +1017,7 @@ fun PlayerScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivePlayerMenu.VOLUME -> {
|
ActivePlayerMenu.VOLUME -> {
|
||||||
item {
|
item {
|
||||||
MenuSectionHeader("Volume Control")
|
MenuSectionHeader("Volume Control")
|
||||||
@@ -931,14 +1069,16 @@ fun PlayerScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivePlayerMenu.SETTINGS -> {
|
ActivePlayerMenu.SETTINGS -> {
|
||||||
item {
|
item {
|
||||||
MenuSectionHeader("Available Sources (${resolvedStreams.size})")
|
MenuSectionHeader("Available Sources (${resolvedStreams.size})")
|
||||||
}
|
}
|
||||||
items(resolvedStreams) { stream ->
|
itemsIndexed(resolvedStreams) { index, stream ->
|
||||||
MenuItemRow(
|
MenuItemRow(
|
||||||
label = stream.label,
|
label = stream.label,
|
||||||
isSelected = activeStream?.provider == stream.provider,
|
isSelected = ((activeStream?.provider == stream.provider) && (activeStream?.primaryUrl == stream.primaryUrl)),
|
||||||
|
focusRequester = if (index == 0) menuFirstItemFocusRequester else null,
|
||||||
onClick = {
|
onClick = {
|
||||||
activeStream = stream
|
activeStream = stream
|
||||||
playStream(stream.primaryUrl, stream.headers)
|
playStream(stream.primaryUrl, stream.headers)
|
||||||
@@ -984,6 +1124,7 @@ fun PlayerScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivePlayerMenu.MORE -> {
|
ActivePlayerMenu.MORE -> {
|
||||||
item {
|
item {
|
||||||
MenuSectionHeader("Library")
|
MenuSectionHeader("Library")
|
||||||
@@ -1008,6 +1149,7 @@ fun PlayerScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1074,7 +1216,8 @@ fun PlayerScreen(
|
|||||||
delay(50)
|
delay(50)
|
||||||
try {
|
try {
|
||||||
episodesButtonFocusRequester.requestFocus()
|
episodesButtonFocusRequester.requestFocus()
|
||||||
} catch (_: Exception) {}
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -1105,6 +1248,7 @@ fun PlayerScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PlayerCircleButton(
|
private fun PlayerCircleButton(
|
||||||
icon: androidx.compose.ui.graphics.vector.ImageVector,
|
icon: androidx.compose.ui.graphics.vector.ImageVector,
|
||||||
@@ -1125,6 +1269,8 @@ private fun PlayerCircleButton(
|
|||||||
.videoTint(isFocused, isSelected)
|
.videoTint(isFocused, isSelected)
|
||||||
.then(if (focusRequester != null) Modifier.focusRequester(focusRequester) else Modifier)
|
.then(if (focusRequester != null) Modifier.focusRequester(focusRequester) else Modifier)
|
||||||
.onFocusChanged { isFocused = it.isFocused }
|
.onFocusChanged { isFocused = it.isFocused }
|
||||||
|
.focusable()
|
||||||
|
.videoTint(isFocused, isSelected)
|
||||||
.onKeyEvent { event ->
|
.onKeyEvent { event ->
|
||||||
if (event.type == KeyEventType.KeyDown && event.nativeKeyEvent.keyCode == KeyEvent.KEYCODE_DPAD_DOWN && onDownPress != null) {
|
if (event.type == KeyEventType.KeyDown && event.nativeKeyEvent.keyCode == KeyEvent.KEYCODE_DPAD_DOWN && onDownPress != null) {
|
||||||
onDownPress()
|
onDownPress()
|
||||||
@@ -1132,7 +1278,6 @@ private fun PlayerCircleButton(
|
|||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
.focusable()
|
|
||||||
.clickable(
|
.clickable(
|
||||||
interactionSource = remember { MutableInteractionSource() },
|
interactionSource = remember { MutableInteractionSource() },
|
||||||
indication = null
|
indication = null
|
||||||
@@ -1146,6 +1291,7 @@ private fun PlayerCircleButton(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PlayerEpisodesButton(
|
private fun PlayerEpisodesButton(
|
||||||
focusRequester: FocusRequester,
|
focusRequester: FocusRequester,
|
||||||
@@ -1171,6 +1317,7 @@ private fun PlayerEpisodesButton(
|
|||||||
onLeftPress()
|
onLeftPress()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_UP -> {
|
KeyEvent.KEYCODE_DPAD_UP -> {
|
||||||
onUpPress()
|
onUpPress()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
@@ -1193,6 +1340,7 @@ private fun PlayerEpisodesButton(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PlayerCenterPlayButton(
|
private fun PlayerCenterPlayButton(
|
||||||
isPlaying: Boolean,
|
isPlaying: Boolean,
|
||||||
@@ -1232,6 +1380,7 @@ private fun PlayerCenterPlayButton(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PlayerPillButton(
|
private fun PlayerPillButton(
|
||||||
text: String,
|
text: String,
|
||||||
@@ -1279,6 +1428,7 @@ private fun PlayerPillButton(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PlayerSeekBar(
|
private fun PlayerSeekBar(
|
||||||
currentPositionMs: Long,
|
currentPositionMs: Long,
|
||||||
@@ -1297,7 +1447,10 @@ private fun PlayerSeekBar(
|
|||||||
if (!isFocused) isScrubbingMode = false
|
if (!isFocused) isScrubbingMode = false
|
||||||
}
|
}
|
||||||
val barHeight by animateDpAsState(if (isFocused || isScrubbingMode) 6.dp else 4.dp, label = "bar_height")
|
val barHeight by animateDpAsState(if (isFocused || isScrubbingMode) 6.dp else 4.dp, label = "bar_height")
|
||||||
val thumbScale by animateFloatAsState(if (isScrubbingMode) 1.5f else if (isFocused) 1.3f else 1.0f, label = "thumb_scale")
|
val thumbScale by animateFloatAsState(
|
||||||
|
if (isScrubbingMode) 1.5f else if (isFocused) 1.3f else 1.0f,
|
||||||
|
label = "thumb_scale"
|
||||||
|
)
|
||||||
val progressFraction = if (durationMs > 0) (currentPositionMs.toFloat() / durationMs).coerceIn(0f, 1f) else 0f
|
val progressFraction = if (durationMs > 0) (currentPositionMs.toFloat() / durationMs).coerceIn(0f, 1f) else 0f
|
||||||
val bufferFraction = if (durationMs > 0) (bufferedPositionMs.toFloat() / durationMs).coerceIn(0f, 1f) else 0f
|
val bufferFraction = if (durationMs > 0) (bufferedPositionMs.toFloat() / durationMs).coerceIn(0f, 1f) else 0f
|
||||||
Box(
|
Box(
|
||||||
@@ -1313,12 +1466,14 @@ private fun PlayerSeekBar(
|
|||||||
onUpPress()
|
onUpPress()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_DOWN -> {
|
KeyEvent.KEYCODE_DPAD_DOWN -> {
|
||||||
if (onRequestEpisodesFocus != null) {
|
if (onRequestEpisodesFocus != null) {
|
||||||
onRequestEpisodesFocus()
|
onRequestEpisodesFocus()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
KeyEvent.KEYCODE_DPAD_RIGHT -> {
|
||||||
if (isScrubbingMode) {
|
if (isScrubbingMode) {
|
||||||
onSeekRight()
|
onSeekRight()
|
||||||
@@ -1333,10 +1488,12 @@ private fun PlayerSeekBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_LEFT -> {
|
KeyEvent.KEYCODE_DPAD_LEFT -> {
|
||||||
onSeekLeft()
|
onSeekLeft()
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER -> {
|
KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER -> {
|
||||||
isScrubbingMode = !isScrubbingMode
|
isScrubbingMode = !isScrubbingMode
|
||||||
return@onKeyEvent true
|
return@onKeyEvent true
|
||||||
@@ -1404,6 +1561,7 @@ private fun PlayerSeekBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MenuSectionHeader(title: String) {
|
private fun MenuSectionHeader(title: String) {
|
||||||
Text(
|
Text(
|
||||||
@@ -1415,6 +1573,7 @@ private fun MenuSectionHeader(title: String) {
|
|||||||
modifier = Modifier.padding(start = 12.dp, end = 12.dp, top = 12.dp, bottom = 6.dp)
|
modifier = Modifier.padding(start = 12.dp, end = 12.dp, top = 12.dp, bottom = 6.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MenuItemRow(
|
private fun MenuItemRow(
|
||||||
label: String,
|
label: String,
|
||||||
@@ -1459,6 +1618,7 @@ private fun MenuItemRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MiniSelectButton(
|
private fun MiniSelectButton(
|
||||||
text: String,
|
text: String,
|
||||||
@@ -1493,6 +1653,7 @@ private fun MiniSelectButton(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun DrawerEpisodeCard(
|
private fun DrawerEpisodeCard(
|
||||||
episode: Episode,
|
episode: Episode,
|
||||||
@@ -1599,6 +1760,7 @@ private fun DrawerEpisodeCard(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SeasonSelectChip(
|
private fun SeasonSelectChip(
|
||||||
season: Season,
|
season: Season,
|
||||||
@@ -1628,6 +1790,7 @@ private fun SeasonSelectChip(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatTime(ms: Long): String {
|
private fun formatTime(ms: Long): String {
|
||||||
val totalSeconds = (ms / 1000).coerceAtLeast(0)
|
val totalSeconds = (ms / 1000).coerceAtLeast(0)
|
||||||
val hours = totalSeconds / 3600
|
val hours = totalSeconds / 3600
|
||||||
|
|||||||
0
android/gradlew
vendored
Normal file → Executable file
0
android/gradlew
vendored
Normal file → Executable file
903
package-lock.json
generated
903
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tv",
|
"name": "tv",
|
||||||
"version": "1.0.8",
|
"version": "1.0.9",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
"android": "node scripts/build-android.mjs"
|
"android": "node scripts/build-android.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vyla-entertainment/sdk": "^1.18.0",
|
"@vyla-entertainment/sdk": "^1.29.0",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"express": "^4.19.2",
|
"express": "^4.22.3",
|
||||||
"hls.js": "^1.7.3"
|
"hls.js": "^1.7.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -21,5 +21,9 @@
|
|||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC"
|
"license": "ISC",
|
||||||
|
"allowScripts": {
|
||||||
|
"esbuild@0.25.12": true,
|
||||||
|
"koffi@2.16.4": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Vyla TV",
|
|
||||||
"version": "1.0.6",
|
|
||||||
"package": "Vyla-TV_1.0.6.apk",
|
|
||||||
"releaseDate": "2026-10-06T03:41:56.445Z"
|
|
||||||
}
|
|
||||||
@@ -56,14 +56,52 @@ globalThis.VylaLocal = {
|
|||||||
`;
|
`;
|
||||||
fs.writeFileSync(path.join(tmp, 'entry.js'), entry);
|
fs.writeFileSync(path.join(tmp, 'entry.js'), entry);
|
||||||
|
|
||||||
|
const nodeStubPlugin = {
|
||||||
|
name: 'node-stub',
|
||||||
|
setup(build) {
|
||||||
|
build.onResolve(
|
||||||
|
{
|
||||||
|
filter: /^(node:|fs(\/promises)?$|path$|crypto$|https$|http$|events$|os$|stream$|util$|url$|zlib$|net$|tls$|child_process$|worker_threads$|async_hooks$|perf_hooks$|readline$|koffi$|piscina$|node-tls-client$)/,
|
||||||
|
},
|
||||||
|
(args) => ({
|
||||||
|
path: args.path,
|
||||||
|
namespace: 'node-stub',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
build.onLoad({ filter: /^node-tls-client$/, namespace: 'node-stub' }, () => ({
|
||||||
|
contents: `
|
||||||
|
export const ClientIdentifier = {};
|
||||||
|
export const destroyTLS = async () => {};
|
||||||
|
export const initTLS = async () => {};
|
||||||
|
export class Session {
|
||||||
|
async get() { throw new Error('node-tls-client not supported in webview'); }
|
||||||
|
async post() { throw new Error('node-tls-client not supported on webview'); }
|
||||||
|
async close() {}
|
||||||
|
}
|
||||||
|
export default { ClientIdentifier, destroyTLS, initTLS, Session };
|
||||||
|
`,
|
||||||
|
loader: 'js',
|
||||||
|
}));
|
||||||
|
|
||||||
|
build.onLoad({ filter: /.*/, namespace: 'node-stub' }, () => ({
|
||||||
|
contents: 'module.exports = {};',
|
||||||
|
loader: 'js',
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
await build({
|
await build({
|
||||||
entryPoints: [path.join(tmp, 'entry.js')],
|
entryPoints: [path.join(tmp, 'entry.js')],
|
||||||
bundle: true,
|
bundle: true,
|
||||||
format: 'iife',
|
format: 'iife',
|
||||||
target: 'chrome70',
|
target: 'chrome70',
|
||||||
platform: 'browser',
|
platform: 'browser',
|
||||||
|
plugins: [nodeStubPlugin],
|
||||||
minify: true,
|
minify: true,
|
||||||
alias: { 'node:crypto': path.join(shim, 'crypto.js') },
|
alias: {
|
||||||
|
'node:crypto': path.join(shim, 'crypto.js')
|
||||||
|
},
|
||||||
inject: [path.join(shim, 'inject.js')],
|
inject: [path.join(shim, 'inject.js')],
|
||||||
outfile: path.join(www, 'js/vyla-local.js'),
|
outfile: path.join(www, 'js/vyla-local.js'),
|
||||||
logLevel: 'info'
|
logLevel: 'info'
|
||||||
|
|||||||
1
scripts/empty-shim.js
Normal file
1
scripts/empty-shim.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export default {};
|
||||||
Reference in New Issue
Block a user