File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
composeApp/src/commonMain/kotlin/com/jankinwu/fntv/client/ui Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ fun SpeedControlFlyout(
9393 onHoverStateChanged : ((Boolean ) -> Unit )? = null,
9494 onSpeedSelected : (SpeedItem ) -> Unit = {}
9595) {
96- var selectedSpeed by remember { mutableStateOf(defaultSpeed) }
96+ var selectedSpeed by remember(defaultSpeed) { mutableStateOf(defaultSpeed) }
9797 var isExpanded by remember { mutableStateOf(false ) }
9898 val coroutineScope = rememberCoroutineScope()
9999 var hideJob by remember { mutableStateOf<Job ?>(null ) }
Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ import com.jankinwu.fntv.client.ui.component.player.NextEpisodePreviewFlyout
115115import com.jankinwu.fntv.client.ui.component.player.PlayerSettingsMenu
116116import com.jankinwu.fntv.client.ui.component.player.QualityControlFlyout
117117import com.jankinwu.fntv.client.ui.component.player.SpeedControlFlyout
118+ import com.jankinwu.fntv.client.ui.component.player.speeds
118119import com.jankinwu.fntv.client.ui.component.player.SubtitleControlFlyout
119120import com.jankinwu.fntv.client.ui.component.player.SubtitleOverlay
120121import com.jankinwu.fntv.client.data.model.SubtitleSettings
@@ -1512,7 +1513,18 @@ fun PlayerControlRow(
15121513 verticalAlignment = Alignment .CenterVertically
15131514 ) {
15141515 // 倍速
1516+ val playbackSpeedFeature = remember(mediaPlayer) { mediaPlayer.features[PlaybackSpeed ] }
1517+
1518+ // 直接访问 State 的 value 属性以触发重组
1519+ val speedStateValue = playbackSpeedFeature?.value
1520+ val currentSpeedValue = (speedStateValue as ? Number )?.toFloat() ? : 1f
1521+
1522+ val currentSpeedItem = remember(currentSpeedValue) {
1523+ speeds.find { kotlin.math.abs(it.value - currentSpeedValue) < 0.01f } ? : speeds.find { it.value == 1.0f } ? : speeds[4 ]
1524+ }
1525+
15151526 SpeedControlFlyout (
1527+ defaultSpeed = currentSpeedItem,
15161528 yOffset = 70 ,
15171529 onHoverStateChanged = onSpeedControlHoverChanged,
15181530 onSpeedSelected = { item ->
You can’t perform that action at this time.
0 commit comments