mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 08:18:19 +00:00
38 lines
1.1 KiB
Swift
38 lines
1.1 KiB
Swift
|
import SwiftUI
|
||
|
|
||
|
struct PlaybackStatsView: View {
|
||
|
@ObservedObject private var networkState = NetworkStateModel.shared
|
||
|
|
||
|
private var player: PlayerModel { .shared }
|
||
|
|
||
|
var body: some View {
|
||
|
VStack(alignment: .leading, spacing: 6) {
|
||
|
mpvPlaybackStatRow("Hardware decoder", player.mpvBackend.hwDecoder)
|
||
|
mpvPlaybackStatRow("Dropped frames", String(player.mpvBackend.frameDropCount))
|
||
|
mpvPlaybackStatRow("Stream FPS", String(format: "%.2ffps", player.mpvBackend.outputFps))
|
||
|
mpvPlaybackStatRow("Cached time", String(format: "%.2fs", player.mpvBackend.cacheDuration))
|
||
|
}
|
||
|
.padding(.top, 2)
|
||
|
#if os(tvOS)
|
||
|
.font(.system(size: 20))
|
||
|
#else
|
||
|
.font(.system(size: 11))
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
func mpvPlaybackStatRow(_ label: String, _ value: String) -> some View {
|
||
|
HStack {
|
||
|
Text(label)
|
||
|
.foregroundColor(.secondary)
|
||
|
Spacer()
|
||
|
Text(value)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
struct PlaybackStatsView_Previews: PreviewProvider {
|
||
|
static var previews: some View {
|
||
|
PlaybackStatsView()
|
||
|
}
|
||
|
}
|