1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 23:00:32 +05:30
yattee/Shared/Player/Controls/OSD/NetworkState.swift

27 lines
718 B
Swift
Raw Normal View History

import SwiftUI
struct NetworkState: View {
@EnvironmentObject<PlayerModel> private var player
@EnvironmentObject<NetworkStateModel> private var model
var body: some View {
Buffering(state: model.fullStateText)
2022-06-25 05:09:29 +05:30
.opacity(visible ? 1 : 0)
}
var visible: Bool {
2022-08-06 19:58:19 +05:30
player.isPlaying && ((player.activeBackend == .mpv && model.pausedForCache) || player.isSeeking)
}
}
struct NetworkState_Previews: PreviewProvider {
static var previews: some View {
let networkState = NetworkStateModel()
networkState.bufferingState = 30
return NetworkState()
.environmentObject(networkState)
.environmentObject(PlayerModel())
}
}