Playing Video with AVPlayer in SwiftUI
['Benoit Pasquier']
Benoit Pasquier - Swift, Data and more
gravity = gravity } func makeUIView ( context : Context ) -> PlayerView { return PlayerView ( player : player , gravity : gravity ) } func updateUIView ( _ uiView : PlayerView , context : Context ) { } } struct ContentView : View { let model : PlayerViewModel init () { model = PlayerViewModel ( fileName : "video" ) } var body : some View { PlayerContainerView ( player : model . play () } @ Published var isPlaying : Bool = false { didSet { if isPlaying { play () } else { pause () } } } func play () { let currentItem = player .