mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-04 00:47:00 +01:00
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:
1 parent
f0fe90f0fe
commit
7790ae9cbb
6 files changed
+311
-5
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user