VimeoNetworking
VimeoNetworking copied to clipboard
Can't Play Video
When i integrated the VimeoNetworking, then the videos uploaded on my vimeo account are playing fine within my app. Few days ago, I discovered that videos are not playing in the app anymore. Now I am getting "Video link not valid" error which I have put in the code below.
// here is the method which loads the video
// identifier would be a unique vimeo video id e.g, 188914574
fileprivate func loadDemoVideo(identifier: String) {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let isAuthenticated = appDelegate.vimeoManager.isAuthenticated
if isAuthenticated {
appDelegate.vimeoManager.**loadVideo**(identifier: identifier) { (video) in
if let video = video {
// set video view aspect with respect to video aspect
let aspect = ((video.height ?? 1) as! CGFloat) / ((video.width ?? 0) as! CGFloat)
let height = self.playerView.frame.size.width * (aspect > 1.25 ? 1.25 : aspect)
self.videoViewHeightCst.constant = height
if let files = video.files as? [VIMVideoFile] {
if files.count > 0, let fileURL = files.last?.link {
let url = URL(string: fileURL)!
self.loadVideoControllerInView(url: url)
}
}else{
self.view.makeToast("Video link not valid")
}
}
}
}else{
self.view.makeToast("Video not isAuthenticated")
}
}
// Load video method which I have used in above code
func loadVideo(identifier: String, completion: @escaping (VIMVideo?) -> Void) {
let videoRequest = Request<VIMVideo>(path: "/videos/\(identifier)")
let _ = vimeoClient.request(videoRequest) { result in
switch result {
case .success(let response):
let video: VIMVideo = response.model
completion(video)
case .failure(let error):
print("error retrieving video: \(error)")
completion(nil)
}
}
}