feat(android,ios): play the subtitle files beside an episode

The bridge's open_subtitles opens and publishes them and names the one to
turn on. The native player holds them until mpv has the episode loaded,
adds them with sub-add, and releases them instead when another episode
was loaded in the meantime.
This commit is contained in:
nvrl committed 2026-10-13 21:11:20 +02:00
1 parent f0fe90f0fe
commit 7790ae9cbb
6 files changed
+311 -5

No files matched your search

+10
View File
@@ -305,6 +305,16 @@ final class PlayerHost {
player.setMuted(global.muted)
player.setSpeed(global.speed)
player.setPaused(false)
// While mpv opens the episode; the player holds them until it has.
let generation = player.generation
let subtitleLanguage = show?.subtitleLanguage ?? global.subtitleLanguage
let subtitles = show?.subtitles ?? global.subtitles
Task {
guard let files = try? await NativeRuntime.engine().openSubtitles(
shareId: episode.shareId, linkId: episode.linkId, language: subtitleLanguage
) else { return }
player.addSubtitles(generation: generation, files: files, subtitles: subtitles)
}
startSaving()
} catch {
if Task.isCancelled || self.session !== session {