Added a tip that it's a video, and not an image when autoplay is off (#939)

* Added a tip that it's a video, and not an image when autoplay is off

* Centered - bigger version of the video tip
This commit is contained in:
Thomas Durand 2023-02-19 11:44:18 +01:00 committed by GitHub
parent 6a03e06d3a
commit dd2ebe5506
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
import AVKit import AVKit
import DesignSystem
import Env import Env
import SwiftUI import SwiftUI
@ -45,12 +46,22 @@ class VideoPlayerViewModel: ObservableObject {
struct VideoPlayerView: View { struct VideoPlayerView: View {
@Environment(\.scenePhase) private var scenePhase @Environment(\.scenePhase) private var scenePhase
@EnvironmentObject private var preferences: UserPreferences @EnvironmentObject private var preferences: UserPreferences
@EnvironmentObject private var theme: Theme
@StateObject var viewModel: VideoPlayerViewModel @StateObject var viewModel: VideoPlayerViewModel
var body: some View { var body: some View {
VStack { ZStack {
VideoPlayer(player: viewModel.player) VideoPlayer(player: viewModel.player)
if !preferences.autoPlayVideo {
Image(systemName: "play.fill")
.font(.largeTitle)
.foregroundColor(theme.tintColor)
.padding()
.background(Circle().fill(.thinMaterial))
.padding(theme.statusDisplayStyle == .compact ? 0 : 10)
}
}.onAppear { }.onAppear {
viewModel.preparePlayer(autoPlay: preferences.autoPlayVideo) viewModel.preparePlayer(autoPlay: preferences.autoPlayVideo)
} }