mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 04:04:07 +00:00
Default player instance setting
This commit is contained in:
@@ -53,6 +53,7 @@ extension Defaults.Keys {
|
||||
|
||||
static let quality = Key<Stream.ResolutionSetting>("quality", default: .hd720pFirstThenBest)
|
||||
static let playerSidebar = Key<PlayerSidebarSetting>("playerSidebar", default: PlayerSidebarSetting.defaultValue)
|
||||
static let playerInstanceID = Key<Instance.ID?>("playerInstance")
|
||||
static let showKeywords = Key<Bool>("showKeywords", default: false)
|
||||
|
||||
static let recentlyOpened = Key<[RecentItem]>("recentlyOpened", default: [])
|
||||
|
@@ -2,6 +2,8 @@ import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct PlaybackSettings: View {
|
||||
@Default(.instances) private var instances
|
||||
@Default(.playerInstanceID) private var playerInstanceID
|
||||
@Default(.quality) private var quality
|
||||
@Default(.playerSidebar) private var playerSidebar
|
||||
@Default(.showKeywords) private var showKeywords
|
||||
@@ -13,6 +15,8 @@ struct PlaybackSettings: View {
|
||||
#endif
|
||||
|
||||
var body: some View {
|
||||
playerInstanceSection
|
||||
|
||||
qualitySection
|
||||
|
||||
#if !os(tvOS)
|
||||
@@ -24,6 +28,24 @@ struct PlaybackSettings: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
private var playerInstanceSection: some View {
|
||||
Section(header: Text("Preferred playback source")) {
|
||||
Picker("Source", selection: $playerInstanceID) {
|
||||
Text("Best available stream").tag(String?.none)
|
||||
|
||||
ForEach(instances) { instance in
|
||||
Text(instance.longDescription).tag(Optional(instance.id))
|
||||
}
|
||||
}
|
||||
.labelsHidden()
|
||||
#if os(iOS)
|
||||
.pickerStyle(.automatic)
|
||||
#elseif os(tvOS)
|
||||
.pickerStyle(.inline)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private var qualitySection: some View {
|
||||
Section(header: Text("Quality")) {
|
||||
Picker("Quality", selection: $quality) {
|
||||
|
Reference in New Issue
Block a user