Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Can't Play Video #432

Open
faixan23 opened this issue Feb 3, 2021 · 0 comments
Open

Can't Play Video #432

faixan23 opened this issue Feb 3, 2021 · 0 comments

Comments

@faixan23
Copy link

faixan23 commented Feb 3, 2021

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)
            }
        }
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant