Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: crossfade #92

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class MainActivity : ComponentActivity() {
player.play()
}
},
onSwitchExoPlayer = { player.switchExoplayer() },
onSeek = { player.seek(it, TimeUnit.MILLISECONDS) }
)
}
Expand Down Expand Up @@ -242,6 +243,7 @@ fun MainScreen(
onTopBarAction: () -> Unit = {},
onPlayPause: () -> Unit = {},
onSeek: (Long) -> Unit = {},
onSwitchExoPlayer: () -> Unit = {},
) {
Surface(
modifier = Modifier.fillMaxSize(),
Expand Down Expand Up @@ -282,6 +284,7 @@ fun MainScreen(
onNext = onNext,
isPaused = isPaused,
onPlayPause = onPlayPause,
onSwitchExoPlayer = onSwitchExoPlayer,
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 60.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.material.icons.rounded.FastForward
import androidx.compose.material.icons.rounded.FastRewind
import androidx.compose.material.icons.rounded.PauseCircle
import androidx.compose.material.icons.rounded.PlayCircle
import androidx.compose.material.icons.rounded.Refresh
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
Expand All @@ -29,6 +30,7 @@ fun PlayerControls(
onNext: () -> Unit = {},
isPaused: Boolean,
onPlayPause: () -> Unit = {},
onSwitchExoPlayer: () -> Unit = {},
) {
Row(
verticalAlignment = Alignment.CenterVertically,
Expand Down Expand Up @@ -85,6 +87,26 @@ fun PlayerControls(
)
}
}
Row (
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
modifier = modifier
) {
IconButton(
onClick = onSwitchExoPlayer,
modifier = Modifier
.height(48.dp)
.width(48.dp)
) {
Icon(
Icons.Rounded.Refresh,
contentDescription = "changeExoPlayer",
modifier = Modifier
.height(48.dp)
.width(48.dp)
)
}
}
}

@Preview(showBackground = true)
Expand Down
Loading