This commit is contained in:
cd16b 2024-01-23 09:58:26 +01:00
parent f9454029f7
commit 674699aeab

View file

@ -253,22 +253,26 @@ constructor(
if (player.currentMediaItem != null && player.currentMediaItem!!.mediaId.isNotEmpty()) { if (player.currentMediaItem != null && player.currentMediaItem!!.mediaId.isNotEmpty()) {
val itemId = UUID.fromString(player.currentMediaItem!!.mediaId) val itemId = UUID.fromString(player.currentMediaItem!!.mediaId)
val seconds = player.currentPosition / 1000.0 val seconds = player.currentPosition / 1000.0
intros[itemId]?.let { intro -> if (intros.isNotEmpty()) {
if (seconds > intro.showSkipPromptAt && seconds < intro.hideSkipPromptAt) { intros[itemId]?.let { intro ->
_uiState.update { it.copy(currentIntro = intro) } if (seconds > intro.showSkipPromptAt && seconds < intro.hideSkipPromptAt) {
return@let _uiState.update { it.copy(currentIntro = intro) }
return@let
}
_uiState.update { it.copy(currentIntro = null) }
} }
_uiState.update { it.copy(currentIntro = null) }
} }
credits[itemId]?.let { credit -> if (credits.isNotEmpty()) {
if (seconds > credit.showSkipPromptAt && seconds < credit.hideSkipPromptAt) { credits[itemId]?.let { credit ->
_uiState.update { it.copy(currentCredit = credit) } if (seconds > credit.showSkipPromptAt && seconds < credit.hideSkipPromptAt) {
return@let _uiState.update { it.copy(currentCredit = credit) }
return@let
}
_uiState.update { it.copy(currentCredit = null) }
} }
_uiState.update { it.copy(currentCredit = null) }
} }
handler.postDelayed(this, 1000L)
} }
handler.postDelayed(this, 1000L)
} }
} }
handler.post(playbackProgressRunnable) handler.post(playbackProgressRunnable)