3

I am trying to play videos in my app, but when I selected larger files from data that I download from Dropbox, I get a crossed out play button, and can't see or play my video.

enter image description here

I understand that there must be a couple of reasons why the player might disable itself, but is there a way to get feedback from the player to see what it might be complaining about?

This is my code:

let path = URL.init(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
        let url = path.appendingPathComponent("temp.mov")

        do {
            try data.write(to: url, options: .atomic)
        } catch let error {
            print("WRITING: \(error)")
        }

player = AVPlayer(url: url)
        let playerController = AVPlayerViewController()

        playerController.player = player
        self.addChildViewController(playerController)
        self.view.addSubview(playerController.view)
        playerController.view.frame = videoView.frame

        player.play()

Thanks! JK

Jacobo Koenig
  • 11,728
  • 9
  • 40
  • 75

0 Answers0