Code: Select all
import Foundation
class ViewController: UIViewController, VLCMediaPlayerDelegate {
@IBOutlet weak var videoView: UIView!
@IBOutlet weak var playbackView: UIView!
var player: VLCMediaPlayer = VLCMediaPlayer()
let url = URL(string: "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov")
let documents = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as! String
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let media = VLCMedia(url: url!)
player.media = media
player.delegate = self
player.drawable = videoView
player.startRecording(atPath: documents)
player.play()
}
@IBAction func stopButtonPressed(_ sender: UIButton) {
player.stop()
player.stopRecording()
}
}