jellyflood/Swiftfin/Views/SettingsView/PlaybackQualitySettingsView.swift
Joe f5bd1b8fcd
Customizable Device Profiles (#1169)
* Rename ExperimentalSettingsView.swift to PlaybackQualitySettingsView.swift

Fix Merge

* Rename MaximumBitrateSettingsView.swift to PlaybackQualitySettingsView.swift

fix merge

* Re-implement on Main. Should now have all the Main changed. Added a new change to use the Device Profile as a Transcoding Profile.

* Part 1 -> Making VideoPlayerType into a struct (I Hope) correctly

* Part 1.1 -> Making VideoPlayerType into a struct (I Hope) correctly

* Remove unneeded Files

* Missing file + CustomDeviceProfileSelection -> CustomDeviceProfileAction Rename

* Change + to Appending

* Attempt to add StorageValues+User. Not sure if this is correct?

* Move the Array unwrapping to funcitons. Not required but this should help prevent accidently doing this wrong. Add subtitles back into the custom profiles since that somehow got dropped. Added a PlaybackCompatibility enum. This might need to work for more than just video

* Complete rewrite to allow multiple profiles, compatibility mode, and directplay.

* Hardward -> Hardware

* Update CustomDeviceProfileSettingsView.swift

Double Licensing

* It was actually really easy to implement iOS... Trash cans still look weird and small.

* Swipe to Delete instead of the edit button

* wip

* wip

* Linting

* tvOS Implementation

* wip

* wip

* cleanup

* Create Package.resolved

---------

Co-authored-by: Joseph Kribs <joseph@kribs.net>
Co-authored-by: Ethan Pippin <ethanpippin2343@gmail.com>
2024-09-02 15:33:02 -06:00

80 lines
2.6 KiB
Swift

//
// Swiftfin is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//
import Defaults
import SwiftUI
struct PlaybackQualitySettingsView: View {
@Default(.VideoPlayer.Playback.appMaximumBitrate)
private var appMaximumBitrate
@Default(.VideoPlayer.Playback.appMaximumBitrateTest)
private var appMaximumBitrateTest
@Default(.VideoPlayer.Playback.compatibilityMode)
private var compatibilityMode
@EnvironmentObject
private var router: SettingsCoordinator.Router
var body: some View {
Form {
Section {
CaseIterablePicker(
L10n.maximumBitrate,
selection: $appMaximumBitrate
)
} header: {
L10n.bitrateDefault.text
} footer: {
L10n.bitrateDefaultDescription.text
}
.animation(.none, value: appMaximumBitrate)
if appMaximumBitrate == .auto {
Section {
CaseIterablePicker(
L10n.testSize,
selection: $appMaximumBitrateTest
)
} header: {
L10n.bitrateTest.text
} footer: {
VStack(alignment: .leading, spacing: 8) {
L10n.bitrateTestDescription.text
L10n.bitrateTestDisclaimer.text
}
}
}
// TODO: Have a small description and a "Learn More..."
// button that will open a page for longer descriptions
// of each option. See: iOS Settings/Accessibility/VoiceOver
// for reference
Section {
CaseIterablePicker(
L10n.compatibility,
selection: $compatibilityMode
)
.animation(.none, value: compatibilityMode)
if compatibilityMode == .custom {
ChevronButton(L10n.profiles)
.onSelect {
router.route(to: \.customDeviceProfileSettings)
}
}
} header: {
L10n.deviceProfile.text
}
}
.animation(.linear, value: appMaximumBitrate)
.animation(.linear, value: compatibilityMode)
.navigationTitle(L10n.playbackQuality)
}
}