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

View file

@ -253,6 +253,7 @@ 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
if (intros.isNotEmpty()) {
intros[itemId]?.let { intro -> intros[itemId]?.let { intro ->
if (seconds > intro.showSkipPromptAt && seconds < intro.hideSkipPromptAt) { if (seconds > intro.showSkipPromptAt && seconds < intro.hideSkipPromptAt) {
_uiState.update { it.copy(currentIntro = intro) } _uiState.update { it.copy(currentIntro = intro) }
@ -260,6 +261,8 @@ constructor(
} }
_uiState.update { it.copy(currentIntro = null) } _uiState.update { it.copy(currentIntro = null) }
} }
}
if (credits.isNotEmpty()) {
credits[itemId]?.let { credit -> credits[itemId]?.let { credit ->
if (seconds > credit.showSkipPromptAt && seconds < credit.hideSkipPromptAt) { if (seconds > credit.showSkipPromptAt && seconds < credit.hideSkipPromptAt) {
_uiState.update { it.copy(currentCredit = credit) } _uiState.update { it.copy(currentCredit = credit) }
@ -267,9 +270,10 @@ constructor(
} }
_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)
if (intros.isNotEmpty() || credits.isNotEmpty()) handler.post(skipCheckRunnable) if (intros.isNotEmpty() || credits.isNotEmpty()) handler.post(skipCheckRunnable)