Hey there,
I wanted to play a local video in my app using the Apple introduction (https://developer.apple.com/documentation/avfoundation/media_assets_playback_and_editing/creating_a_basic_video_player_ios_and_tvos ).
Unfortunately it is not possible to use a local file for this.
Here is my code:
Where is the issue?
In console I always get the message "Video file not found".
I implemented the video file in Assets.xcassets.
Help is welcome!
I wanted to play a local video in my app using the Apple introduction (https://developer.apple.com/documentation/avfoundation/media_assets_playback_and_editing/creating_a_basic_video_player_ios_and_tvos ).
Unfortunately it is not possible to use a local file for this.
Here is my code:
Code Block @IBAction func playVideo(_ sender: Any) { guard let path = Bundle.main.url(forResource: "Video", withExtension: "mp4") else { print("Video file not found") return } let player = AVPlayer(url: path) let controller = AVPlayerViewController() controller.player = player present(controller, animated: true) { player.play() } }
Where is the issue?
In console I always get the message "Video file not found".
I implemented the video file in Assets.xcassets.
Help is welcome!