Code: Select all
import Cocoa
class ViewController: NSViewController {
var player: VLCMediaPlayer = {
return VLCMediaPlayer()
}()
@IBOutlet weak var playerView: NSView!
override func viewDidLoad() {
super.viewDidLoad()
setupPlayer()
}
private func setupPlayer() {
let url = URL(string: "https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4")!
let media = VLCMedia(url: url)
player.media = media
player.drawable = playerView
player.play()
}
}
The problem occurs now if I try to display a local file. I tried creating a local url using:
Code: Select all
fileURL(withPath:)
I then tried passing the absolute path string directly to the VLCMedia constructor with the path argument.
Code: Select all
VLCMedia(path <absolute path>)
By "didn't work" I mean that the view was just transparent nothing happened, no log in the console, it seemed like the setupPlayer never got executed, which it however did.
I am asking hence why I am not able to play local files