mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 14:03:41 +00:00
27 lines
718 B
Swift
27 lines
718 B
Swift
import SwiftUI
|
|
|
|
struct NetworkState: View {
|
|
@EnvironmentObject<PlayerModel> private var player
|
|
@EnvironmentObject<NetworkStateModel> private var model
|
|
|
|
var body: some View {
|
|
Buffering(state: model.fullStateText)
|
|
.opacity(visible ? 1 : 0)
|
|
}
|
|
|
|
var visible: Bool {
|
|
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())
|
|
}
|
|
}
|