fix handling and displaying captions

fixes #490

It also fixes the caption picker being empty when a caption was selected in the previous watched video.
This commit is contained in:
Toni Förster
2024-04-21 01:01:55 +02:00
parent d1cf45c6a1
commit f3637e2426
4 changed files with 19 additions and 14 deletions

View File

@@ -312,7 +312,6 @@ struct ControlsOverlay: View {
.foregroundColor(.primary)
}
.transaction { t in t.animation = .none }
.buttonStyle(.plain)
.foregroundColor(.primary)
.frame(width: 240, height: 40)
@@ -374,12 +373,12 @@ struct ControlsOverlay: View {
let captions = player.currentVideo?.captions ?? []
Picker("Captions", selection: captionsBinding) {
if captions.isEmpty {
Text("Not available")
Text("Not available").tag(Captions?.none)
} else {
Text("Disabled").tag(Captions?.none)
}
ForEach(captions) { caption in
Text(caption.description).tag(Optional(caption))
ForEach(captions) { caption in
Text(caption.description).tag(Optional(caption))
}
}
}
.disabled(captions.isEmpty)

View File

@@ -433,12 +433,12 @@ struct PlaybackSettings: View {
let captions = player.currentVideo?.captions ?? []
Picker("Captions".localized(), selection: $player.captions) {
if captions.isEmpty {
Text("Not available")
Text("Not available").tag(Captions?.none)
} else {
Text("Disabled").tag(Captions?.none)
}
ForEach(captions) { caption in
Text(caption.description).tag(Optional(caption))
ForEach(captions) { caption in
Text(caption.description).tag(Optional(caption))
}
}
}
.disabled(captions.isEmpty)