Minor UI changes

This commit is contained in:
Arkadiusz Fal
2022-06-25 01:39:29 +02:00
parent 7b09805b81
commit c940fb3198
20 changed files with 247 additions and 436 deletions

View File

@@ -2,6 +2,7 @@ import Defaults
import SwiftUI
struct ControlsOverlay: View {
@EnvironmentObject<NetworkStateModel> private var networkState
@EnvironmentObject<PlayerModel> private var player
@EnvironmentObject<PlayerControlsModel> private var model
@@ -165,7 +166,7 @@ struct ControlsOverlay: View {
Text("hw decoder: \(player.mpvBackend.hwDecoder)")
Text("dropped: \(player.mpvBackend.frameDropCount)")
Text("video: \(String(format: "%.2ffps", player.mpvBackend.outputFps))")
Text("buffering: \(String(format: "%.0f%%", player.mpvBackend.bufferingState))")
Text("buffering: \(String(format: "%.0f%%", networkState.bufferingState))")
Text("cache: \(String(format: "%.2fs", player.mpvBackend.cacheDuration))")
}
.mask(RoundedRectangle(cornerRadius: 3))

View File

@@ -6,7 +6,11 @@ struct NetworkState: View {
var body: some View {
Buffering(state: model.fullStateText)
.opacity(model.pausedForCache || player.isSeeking ? 1 : 0)
.opacity(visible ? 1 : 0)
}
var visible: Bool {
player.isPlaying && (model.pausedForCache || player.isSeeking)
}
}

View File

@@ -23,8 +23,6 @@ struct PlayerControls: View {
@FocusState private var focusedField: Field?
#endif
@Default(.controlsBarInPlayer) private var controlsBarInPlayer
init(player: PlayerModel, thumbnails: ThumbnailsModel) {
self.player = player
self.thumbnails = thumbnails
@@ -191,12 +189,13 @@ struct PlayerControls: View {
HStack(spacing: 20) {
#if !os(tvOS)
fullscreenButton
pipButton
#if os(iOS)
pipButton
#endif
Spacer()
button("overlay", systemImage: "info.circle") {}
button("settings", systemImage: "gearshape", active: model.presentingControlsOverlay) {
withAnimation(Self.animation) {
model.presentingControlsOverlay.toggle()