从远程播放MKV视频

问题描述 投票:5回答:1

我正在尝试在我的iOS应用中播放远程MKV视频,但视频无法播放。

我尝试使用AVKit / AVFoundation和MobilePlayer,它正在使用MP4文件。

这是我的代码示例:

AVKit / AVFoundation

let videoURL = NSURL(string: url)! // http://localhost:4000/../file.mkv
playerView = AVPlayer(URL: videoURL)
playerViewController.player = playerView
self.presentViewController(playerViewController, animated: true) {
  self.playerViewController.player!.play()
}

MobilePlayer

let videoURL = NSURL(string: url)! // http://localhost:4000/../file.mkv
let playerVC = MobilePlayerViewController(contentURL: videoURL)
playerVC.title = videoURL.lastPathComponent
playerVC.activityItems = [videoURL]
self.presentViewController(playerVC, animated: true) { 
  playerVC.play()
}
ios swift video-player mkv
1个回答
2
投票

AVKit / AVFoundation不支持mkv视频格式。您可以考虑使用其他视频框架,例如VLCKit

© www.soinside.com 2019 - 2024. All rights reserved.