0

I have been using AVKit to stream a video, below is the code I am using to stream videos in TVOS. But the problem is I am unable to do the same with the Dropbox Link? Is a Dropbox API integration required for this?

func _viewVideo(_ url: Foundation.URL)
{
    let url = Foundation.URL(string: "http://techslides.com/demos/sample-videos/small.mp4")

    let asset = AVURLAsset(url: url)

    let item = AVPlayerItem(asset: asset)

    let player = AVPlayer(playerItem: item)
    playerViewController?.player = player
    playerViewController?.view.frame = CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height)
    playerViewController?.showsPlaybackControls = true

    self.view.addSubview((playerViewController?.view)!)
    player.play()
}
Greg
  • 16,359
  • 2
  • 34
  • 44
sajang
  • 63
  • 7

1 Answers1

1

You can stream videos from Dropbox share links in Apple TV, however, you need to make a tiny change in the link.

You need to force a file to download in your link, just change the end of the link from dl=0 to dl=1. In this way, Apple TV can stream videos from Dropbox share links.

For reference: Force a file or folder to download, or to render on dropbox.com

Wei Xia
  • 504
  • 2
  • 9
  • 24