【问题标题】:AVKit unable to stream Dropbox Link VideosAVKit 无法流式传输 Dropbox 链接视频
【发布时间】:2017-03-11 14:23:23
【问题描述】:

我一直在使用 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()
}

【问题讨论】:

  • 您的保管箱链接是下载链接吗? (末尾有dl=1
  • @deadbeef 最后是 dl=0
  • dl=0 表示下载 = false(用于在浏览器中显示)。将其更改为 dl=1
  • 可以在这里找到相关信息:dropbox.com/help/201

标签: ios dropbox tvos avkit


【解决方案1】:

您可以从 Apple TV 中的 Dropbox 共享链接流式传输视频,但是,您需要对链接进行微小的更改。

您需要在链接中强制下载文件,只需将链接末尾从dl=0 更改为dl=1。通过这种方式,Apple TV 可以从 Dropbox 共享链接流式传输视频。

供参考:Force a file or folder to download, or to render on dropbox.com

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-16
    • 2016-06-17
    • 2016-02-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多