title: Easiest way to play a video from youtube in my app with swiftui?
body: <p>I am trying to make a video player in my app (with swiftUI) that playes videos from youtube when the user creates a URL string. To practise I have seperated this into a new project to see that it works. But the screen is just black with a play button. Nothing happends when I press the play button or the screen.
  This is my code:</p>
  <pre><code>import SwiftUI
  import AVKit
  
  struct ContentView: View {
      
      let url = URL(string: &quot;https://youtu.be/Wlf1T5nrO50&quot;)!
      
      
      var body: some View {
          VStack{
             
              VideoPlayer(player: AVPlayer(url: url))
                  .scaledToFit()
              
          }
  }
  </code></pre>
  <p>I found another video with how to make embedded youtube videos but then you need to just copy the video ID and my user is not that advanced. I want the user to be able to just copy the URL.</p>
  <p>Thankful for any help.</p>