Swift:AVPlayer播放声音但没有视频

时间:2017-09-14 18:43:03

标签: xcode8

有谁知道这个解决方案?我可以听到视频但无法在模拟器中看到它。

    func playinitiate() {

        let locationVideo = NSURL(fileURLWithPath: Bundle.main.path(forResource: "Video", ofType: "mov")!)

        let video = AVPlayer(url: locationVideo as URL)

        let videoLayer = AVPlayerLayer(player: video)

        videoLayer.frame = specialView.bounds

        specialView.layer.addSublayer(videoLayer)

        videoLayer.videoGravity = AVLayerVideoGravityResizeAspectFill

        video.play()

        print("Player is running")

0 个答案:

没有答案