mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
feat: auto fetchfetch addon subtitles
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
8134194461
commit
40588e0ed6
1 changed files with 14 additions and 5 deletions
|
|
@ -1036,6 +1036,12 @@ fun PlayerScreen(
|
||||||
controlsVisible = false
|
controlsVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun fetchAddonSubtitlesForActiveItem() {
|
||||||
|
val type = contentType ?: return
|
||||||
|
val videoId = activeVideoId ?: return
|
||||||
|
SubtitleRepository.fetchAddonSubtitles(type, videoId)
|
||||||
|
}
|
||||||
|
|
||||||
LaunchedEffect(activeSourceUrl, activeSourceAudioUrl, activeSourceHeaders, activeSourceResponseHeaders) {
|
LaunchedEffect(activeSourceUrl, activeSourceAudioUrl, activeSourceHeaders, activeSourceResponseHeaders) {
|
||||||
errorMessage = null
|
errorMessage = null
|
||||||
playerController = null
|
playerController = null
|
||||||
|
|
@ -1066,6 +1072,13 @@ fun PlayerScreen(
|
||||||
playerController?.applySubtitleStyle(subtitleStyle)
|
playerController?.applySubtitleStyle(subtitleStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LaunchedEffect(showSubtitleModal, activeSubtitleTab, contentType, activeVideoId) {
|
||||||
|
if (!showSubtitleModal || activeSubtitleTab != SubtitleTab.Addons) return@LaunchedEffect
|
||||||
|
if (!isLoadingAddonSubtitles && addonSubtitles.isEmpty()) {
|
||||||
|
fetchAddonSubtitlesForActiveItem()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LaunchedEffect(playbackSnapshot.isLoading, playerController) {
|
LaunchedEffect(playbackSnapshot.isLoading, playerController) {
|
||||||
if (!playbackSnapshot.isLoading && playerController != null) {
|
if (!playbackSnapshot.isLoading && playerController != null) {
|
||||||
refreshTracks()
|
refreshTracks()
|
||||||
|
|
@ -1709,11 +1722,7 @@ fun PlayerScreen(
|
||||||
useCustomSubtitles = true
|
useCustomSubtitles = true
|
||||||
playerController?.setSubtitleUri(addon.url)
|
playerController?.setSubtitleUri(addon.url)
|
||||||
},
|
},
|
||||||
onFetchAddonSubtitles = {
|
onFetchAddonSubtitles = ::fetchAddonSubtitlesForActiveItem,
|
||||||
if (contentType != null && activeVideoId != null) {
|
|
||||||
SubtitleRepository.fetchAddonSubtitles(contentType, activeVideoId!!)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onStyleChanged = PlayerSettingsRepository::setSubtitleStyle,
|
onStyleChanged = PlayerSettingsRepository::setSubtitleStyle,
|
||||||
onDismiss = { showSubtitleModal = false },
|
onDismiss = { showSubtitleModal = false },
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue