title: iOS SwiftUI video autoplay
body: <p>I'm working on an iOS app that has a set of buttons on one view, when one of the buttons is tapped, the app navigates to a new view of a video and should autoplay the video. The video is currently not autoplaying, but will play on tap, my understanding is the video should autoplay with the code below. Any help is appreciated (this is my first time building an iOS app).</p>
  <pre><code>let player = AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: &quot;videoToPlay&quot;, ofType: &quot;mp4&quot;)!))
  
  VideoPlayer(player: player)
    .edgesIgnoreSafeArea(.all)
    .onAppear() {
      player.play()
  }
  </code></pre>