Rework YouTube Radio

This commit is contained in:
vfsfitvnm
2022-06-11 23:01:06 +02:00
parent f39276875d
commit a0e42473e6
10 changed files with 222 additions and 219 deletions

View File

@@ -157,50 +157,50 @@ fun CurrentPlaylistView(
)
}
if (YoutubePlayer.Radio.isActive && player != null) {
when (val nextContinuation = YoutubePlayer.Radio.nextContinuation) {
is Outcome.Loading, is Outcome.Success<*> -> {
if (nextContinuation is Outcome.Success<*>) {
item {
SideEffect {
coroutineScope.launch {
YoutubePlayer.Radio.process(
player.mediaController,
force = true
)
}
}
}
}
items(count = 3, key = { it }) { index ->
SmallSongItemShimmer(
shimmer = shimmer,
thumbnailSizeDp = 54.dp,
modifier = Modifier
.alpha(1f - index * 0.125f)
.fillMaxWidth()
.padding(vertical = 4.dp, horizontal = 16.dp)
)
}
}
is Outcome.Error -> item {
Error(
error = nextContinuation
)
}
is Outcome.Recovered<*> -> item {
Error(
error = nextContinuation.error,
onRetry = {
coroutineScope.launch {
YoutubePlayer.Radio.process(player.mediaController, force = true)
}
}
)
}
else -> {}
}
}
// if (YoutubePlayer.Radio.isActive && player != null) {
// when (val nextContinuation = YoutubePlayer.Radio.nextContinuation) {
// is Outcome.Loading, is Outcome.Success<*> -> {
// if (nextContinuation is Outcome.Success<*>) {
// item {
// SideEffect {
// coroutineScope.launch {
// YoutubePlayer.Radio.process(
// player.mediaController,
// force = true
// )
// }
// }
// }
// }
//
// items(count = 3, key = { it }) { index ->
// SmallSongItemShimmer(
// shimmer = shimmer,
// thumbnailSizeDp = 54.dp,
// modifier = Modifier
// .alpha(1f - index * 0.125f)
// .fillMaxWidth()
// .padding(vertical = 4.dp, horizontal = 16.dp)
// )
// }
// }
// is Outcome.Error -> item {
// Error(
// error = nextContinuation
// )
// }
// is Outcome.Recovered<*> -> item {
// Error(
// error = nextContinuation.error,
// onRetry = {
// coroutineScope.launch {
// YoutubePlayer.Radio.process(player.mediaController, force = true)
// }
// }
// )
// }
// else -> {}
// }
// }
}
}