File tree Expand file tree Collapse file tree
pillarbox-cast/src/main/java/ch/srgssr/pillarbox/cast
pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/showcases/integrations/cast Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ class CastPlayerSynchronizer(
4747 .map { if (it) castPlayer else localPlayer }
4848 .distinctUntilChanged()
4949 .onEach { switchPlayer(it) }
50- .stateIn(coroutineScope, SharingStarted .WhileSubscribed ( 5_000 ) , if (castContext.isConnected()) castPlayer else localPlayer)
50+ .stateIn(coroutineScope, SharingStarted .Eagerly , if (castContext.isConnected()) castPlayer else localPlayer)
5151
5252 private fun switchPlayer (player : PillarboxPlayer ) {
5353 val oldPlayer = if (player is PillarboxCastPlayer ) localPlayer else castPlayer
Original file line number Diff line number Diff line change @@ -11,11 +11,11 @@ import androidx.compose.foundation.layout.fillMaxSize
1111import androidx.compose.foundation.layout.fillMaxWidth
1212import androidx.compose.material3.IconButtonColors
1313import androidx.compose.runtime.Composable
14- import androidx.compose.runtime.collectAsState
1514import androidx.compose.runtime.getValue
1615import androidx.compose.ui.Alignment
1716import androidx.compose.ui.Modifier
1817import androidx.compose.ui.graphics.Color
18+ import androidx.lifecycle.compose.collectAsStateWithLifecycle
1919import androidx.lifecycle.viewmodel.compose.viewModel
2020import ch.srgssr.media.maestro.MediaRouteButton
2121import ch.srgssr.pillarbox.demo.shared.data.samples.SamplesGoogle
@@ -30,7 +30,7 @@ import ch.srgssr.pillarbox.demo.ui.player.playlist.PlaylistView
3030@Composable
3131fun CastShowcase () {
3232 val mainViewModel: CastShowcaseViewModel = viewModel()
33- val player by mainViewModel.currentPlayer.collectAsState ()
33+ val player by mainViewModel.currentPlayer.collectAsStateWithLifecycle ()
3434
3535 Column {
3636 Box (
You can’t perform that action at this time.
0 commit comments