How to implement a local video in app iOS swift 5, (4 errors).

Hi, how can I solve this errors ? :

Cannot find type 'Video' in scope.

Cannot find '$selectedVideo' in scope.

Cannot find 'ErrorView' in scope.


import SwiftUI

import AVKit

struct ContentView: View {

    @State private var selectedVideo: Video?  //  the error is here

    var selectedVideo = video   //  the same error

var body:some View {

        NavigationView {

            .fullScreenCover(item: $selectedVideo) {   // error

              // On Dismiss Closure

            } content: { item in

              makeFullScreenVideoPlayer(for: item)

            }

            

            @ViewBuilder

    func makeFullScreenVideoPlayer(for video: Video) -> some View {

              // 1

              if let url = video.videoURL {

                // 2

                let avPlayer = AVPlayer(url: url)

                // 3

                VideoPlayer(player: avPlayer)

                  // 4

                  .edgesIgnoringSafeArea(.all)

                  .onAppear {

                    // 5

                    avPlayer.play()

                  }

              } else {

                ErrorView()  //  error

              }

            }

        ```

Where did you find the class Video ? I cannot find it in doc.

Do you mean VideoPlayer ?

    @State private var selectedVideo: Video?  //  the error is here
    var selectedVideo = video   //  the same error

You declare twice the same var selectedVideo. That's an error.

Where did you find this code ? may have a look here:

How to implement a local video in app iOS swift 5, (4 errors).
 
 
Q