Play MKV video from remote

I am trying to play remote MKV video in my iOS application, but the video will not play.

I tried with AVKit / AVFoundation and MobilePlayer and worked with the MP4 file.

Here is an example of my code:

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()
}
+4
source share
1 answer

AVKit / AVFoundation do not support mkv video format. You may consider using another video card, such as VLCKit .

+1
source

Source: https://habr.com/ru/post/1651830/


All Articles