Hello:
I am adding a video file to my MAC application. Before I create an archive, the video plays perfectly but when I run a copy of the archive, when I click on the button to start the video, NOTHING HAPPENS. No error message, Nothing. Any help to resolve this issue will be appreciated. Here is the code:
This code:
@IBAction func AVSegue(_ sender: Any) {
let mainStoryboard = NSStoryboard(name: "Main", bundle: Bundle.main)
guard let avPlayerViewController = mainStoryboard.instantiateController (withIdentifier: "AVID") as?
AVPlayerViewController else {
print("Couldn't find viewController" )
return
}
presentAsModalWindow(avPlayerViewController)
}
triggers the ViewController with the AV Player:
import Cocoa
import AVKit
import AVFoundation
class AVPlayerViewController: NSViewController {
@IBOutlet weak var playerView: AVPlayerView!
override func viewDidLoad() { super.viewDidLoad()
let url = URL(fileURLWithPath: Bundle.main.path(forResource:"SMRIntro",ofType: "mp4")!)
let player = AVPlayer(url: url)
playerView.player = player
player.play()
}
}