使用MobileVLCKit iOS录制流

时间:2019-04-09 10:46:44

标签: ios swift vlc libvlc

我正在使用MobileVLCKit从RTSP源流式传输。我需要捕获此流,到目前为止,我尝试使用`startRecording(atPath :)将流保存到iOS文档目录中,但是我看不到文档目录中正在生成任何文件。这是我正在尝试的代码:

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()

    }

}

0 个答案:

没有答案