0

I am facing some trouble with playing youtube videos in my tvOS app. I am using the popular XCDYouTubeKit to get the stream URL as shown below.

let playerViewController = AVPlayerViewController()
XCDYouTubeClient.default().getVideoWithIdentifier(videoIdentifier) { [weak playerViewController] (video, error) in
        if(video != nil) {
            let streamURLs = video?.streamURLs
            if let streamURL = streamURLs![278] {
                print(streamURL)
                playerViewController?.player = AVPlayer(url: streamURL)
            }
        }else {
            self.printLog(logEntry: "Video not found")
            self.dismiss(animated: true, completion: nil)
        }
    }

Runs with a log entry

Task <2C60AFA3-B5B0-4D46-BB54-BCB72FDC6FC3>.<1> finished with error - code: -999

The log doesn't explain much. How to play a youtube video from a tvOS app?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Neelesh
  • 3,673
  • 8
  • 47
  • 78

0 Answers0