Vimeo API Video.getPlay 总是 returns 空

Vimeo API Video.getPlay always returns null

我用的是官方Vimeo Android Library.

我是这样添加的:compile 'com.vimeo.networking:vimeo-networking:1.1.1'

下面是我的使用方法:

// where mUri is in the following format: /videos/<videoId>
VimeoClient.getInstance().fetchNetworkContent(mUri, new ModelCallback<Video>(Video.class) {
            @Override
            public void success(Video video) {
                if (!video.getStatus().equals(Video.Status.AVAILABLE)) {
                    // still processing
                } else {
                    // code goes here because its status is already available
                    Log.e("main", "play: " + video.getPlay());
                    // this logs -- play: null
                }
            }
            @Override
            public void failure(VimeoError error) {
                Log.e("main", error.getErrorMessage());
            }
        });

video.getDownload() 有效并为我提供了 3 个数组。我使用与上传视频相同的访问令牌。我也有一个 PRO 帐户。我在邮递员中尝试过,使用完全相同的访问令牌和视频 ID 并且它有效。结果包含一个文件部分 w/c 看起来像这样:

"files": [
        {
            "quality": "sd",
            "type": "video/mp4",
            "width": 480,
            "height": 640,
            "link": "<working string link here, I just replaced it for security>",
            "created_time": "2017-10-26T06:58:09+00:00",
            "fps": 23.980000000000000426325641456060111522674560546875,
            "size": 867030,
            "md5": "<md5 value here, I just replaced it for security>",
            "link_secure": "<working string link here, I just replaced it for security>"
        },
        {
            "quality": "sd",
            ...
        },
        {
            "quality": "hls",
            ...
        }
    ]

这是 3 个带有工作链接的视频。所以我不知道为什么图书馆不检索它们:(

请帮忙,谢谢!

像这样github issue points out you should check this branch on github.

video.getPlay() 仍然 public 不可用。您应该改用它。来自文档。

Video video = ...; // obtain a video you own as described above
ArrayList<VideoFile> videoFiles = video.files;
if(videoFiles != null && !videoFiles.isEmpty()) {
     VideoFile videoFile = videoFiles.get(0); // you could sort these files by size, fps, width/height
     String link = videoFile.getLink();
     // load link
}

如果您参加了所有的要求,您应该能够获得所有的视频文件。该数组将包含 mp4sd、mp4hd 和 hls link.

hls link是数组的最后一个,所以用.

就可以得到
VideoFile videoFile = videoFiles.get(videoFiles.size() - 1);
String hlsLink = videoFile.getLink();