I am using AVPlayer to load video url from a server. It is working for a video in the root but not in the sub-domain.
My AVPlayer code is as follows: Player works with the below URL:
@IBAction func btnPlayClicked(_ sender: Any) {
//let videoURL = URL.init(string: "http://musically.virgoexchange.com/storage/upload/videos/2018/10/1538719219video.mp4")
let videoURL = URL(string: "http://somo.virgoexchange.com/demo.mp4")
self.playVideo(videoURL: videoURL!)
}
Player not working with following url:
@IBAction func btnPlayFinalClicked(_ sender: Any) {
let videoURL = URL(string: "http://somo.virgoexchange.com/user/gallery/video/1535522305_img_0006.mp4")
self.playVideo(videoURL: videoURL!)
}
func playVideo(videoURL:URL) {
let player = AVPlayer(url: videoURL)
let playerViewController = AVPlayerViewController()
playerViewController.player = player
self.present(playerViewController, animated: true) {
playerViewController.player!.play()
}
}
I am not able to identify, whether this issue is from server side or iOS side. As this URL is also not loading on safari web browser too.
Any help will be appreciated.
Thanks, Puja Rathod