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

Can't Play Video #432

@faixan23

Description

@faixan23

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)
            }
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions