I'm trying to play a remote MKV video in my iOS app but the video won't play.
I tried with AVKit/AVFoundation and MobilePlayer and it's working with a MP4 file.
Here's a sample of my code:
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()
}
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()
}
AVKit/AVFoundation don't support mkv video format. You could consider using another video framework such as VLCKit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With