我一直在使用AVKit来传输视频,下面是我用来在TVOS中传输视频的代码。但问题是我无法对Dropbox Link做同样的事情?这需要Dropbox API集成吗?
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()
}
答案 0 :(得分:1)
您可以从Apple TV中的Dropbox共享链接流式传输视频,但是,您需要对链接进行微小更改。
您需要强制在链接中下载文件,只需将链接的结尾从dl=0
更改为dl=1
即可。通过这种方式,Apple TV可以从Dropbox共享链接流式传输视频。
供参考:Force a file or folder to download, or to render on dropbox.com