I need to display a video in my app, and would like to be able to resize it.
On a button, i have a Modal Segue.
The code of the view is :
import Cocoa
import AVKit
import AVFoundation
import MediaPlayer
class NSViewController2: NSViewController {
let controller=AVPlayerView()
override func viewDidLoad() {
super.viewDidLoad()
let player = AVPlayer(url: v2!)
controller.player=player
controller.frame = self.view.frame
self.view.addSubview(controller)
player.play()
}
}
The video starts fine and is displayed, but when i resize the modal windows, the video is not resized ..
Any idea ?
Thanks, Nicolas
If anyone is wondering ..
1/ Add the NSWindowDelegate, in the class
2/ Add the function "windowDidResize"