2022-06-18 18:09:49 +05:30
|
|
|
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 {
|
|
|
|
player.isPlaying && (model.pausedForCache || player.isSeeking)
|
2022-06-18 18:09:49 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct NetworkState_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
let networkState = NetworkStateModel()
|
|
|
|
networkState.bufferingState = 30
|
|
|
|
|
|
|
|
return NetworkState()
|
|
|
|
.environmentObject(networkState)
|
|
|
|
.environmentObject(PlayerModel())
|
|
|
|
}
|
|
|
|
}
|