小编Abh*_*bhi的帖子

如何为 youtube 视频创建 DASH 清单网址?

我正在创建 android 应用程序。我想在 exoplayer 中播放 Youtube 视频。在 exoplayer 演示应用程序中,所有 url 都存储在 media.exolist.json 中,如下所示:

 {
    "uri": "https://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&ipbits=0&expire=19000000000&signature=51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7.8506521BFC350652163895D4C26DEE124209AA9E&key=ik0",
    "extension": "mpd"
  }
Run Code Online (Sandbox Code Playgroud)

我想知道如何为我的 youtube 视频创建这个 manifest dash url。

youtube android android-studio exoplayer exoplayer2.x

6
推荐指数
0
解决办法
219
查看次数

如何压缩文件而不在 zip 目录中创建目录?

我正在尝试在目标路径中压缩文件。一切正常。我的文件被压缩到目标 URL。但问题是当我解压缩时,我的文件在目录中。我不希望我的文件在目录中。当我解压缩时,我想查看我的文件。

这是我的代码:

func zipData() {
    let  path=NSSearchPathForDirectoriesInDomains(.documentDirectory,.userDomainMask,true).first!
    let fileManager = FileManager()

    var sourceURL = URL(fileURLWithPath: path)
    sourceURL.appendPathComponent("/cropsapdb_up_\(useridsaved)")

    var destinationURL = URL(fileURLWithPath: path)
    destinationURL.appendPathComponent("/cropsapdb_up_\(useridsaved).zip")
    do {
        let fm = FileManager.default
        let items = try fm.contentsOfDirectory(atPath: sourceURL.path)
        guard let archive = Archive(url: destinationURL, accessMode: .create) else  {
            print("returning")
            return
        }

        for item in items {
            sourceURL = sourceURL.appendingPathComponent("/\(item)")

            try archive.addEntry(with: sourceURL.lastPathComponent, relativeTo: sourceURL.deletingLastPathComponent())
            guard let archive = Archive(url: destinationURL, accessMode: .update) else  {
                print("returning")
                return
            }

            sourceURL.deleteLastPathComponent()
        }
    } catch { …
Run Code Online (Sandbox Code Playgroud)

zip ios swift zipfoundation

2
推荐指数
1
解决办法
1504
查看次数