Use this link I am trying to play a video on the simulator with AVPlayerViewController
. That work on simulator perfectly. But when I am trying to play it on real Device. It doesn't work.
import UIKit
import AVKit
import AVFoundation
class SafaribroserViewController: UIViewController {
var playerViewController = AVPlayerViewController()
var playerView = AVPlayer()
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func hsdgfsf(_ sender: Any) {
let fileURL = NSURL.init(fileURLWithPath: "/Users/macmini/Downloads/QRCodeReader-master 3/QRCodeReader/small.mp4")
playerView = AVPlayer(url: fileURL as URL)
playerViewController.player = playerView
present(playerViewController,animated:true) {
self.playerViewController.player?.play()
}
}
output on real device
Note:- My real device is connected to MacMini Hotspot.
How Can I Play video on my real device? Thanks