使用AVKit流视频时出现黑屏

时间:2020-03-11 17:54:28

标签: swift avfoundation media-player avkit

嗨,我想在我的应用上流式传输远程视频。网址是:http://test.ext/myvideo.mkv

我将AVKit与此代码一起使用,但屏幕和音频不起作用。我只看到前进的进度条。

         let player = AVPlayer(url: url)

        // Create a new AVPlayerViewController and pass it a reference to the player.
        let controller = AVPlayerViewController()
        controller.player = player
        controller.player?.automaticallyWaitsToMinimizeStalling = false
        controller.player?.playImmediately(atRate: 1.0)


        // Modally present the player and call the player's play() method when complete.
        self.present(controller, animated: true) {
                player.play()
        }

1 个答案:

答案 0 :(得分:0)

AVPlayer不支持mkv视频格式。

有人有播放所有视频格式的解决方案吗?

我已经测试过MobileVLCKit,但是它太重了(1,5Go)...