1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 22:30:32 +05:30
yattee/Shared/Player/Controls/PlaybackStatsView.swift

38 lines
1.1 KiB
Swift
Raw Normal View History

2022-09-02 04:49:15 +05:30
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) {
2022-09-27 18:52:40 +05:30
mpvPlaybackStatRow("Hardware decoder".localized(), player.mpvBackend.hwDecoder)
mpvPlaybackStatRow("Dropped frames".localized(), String(player.mpvBackend.frameDropCount))
2022-11-10 22:41:28 +05:30
mpvPlaybackStatRow("Stream FPS".localized(), player.mpvBackend.formattedOutputFps)
2022-12-22 01:50:54 +05:30
mpvPlaybackStatRow("Cached time".localized(), String(format: "%.2fs", networkState.cacheDuration))
2022-09-02 04:49:15 +05:30
}
.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()
}
}