尝试使用 Vimeo Extractor Library 获取 Vimeo 私人视频的流。 库链接:https://github.com/ed-george/AndroidVimeoExtractor 但是在过去的几天里,一些视频的响应为空,而其他视频正在运行。
VimeoExtractor.getInstance().fetchVideoWithIdentifier(
String.valueOf(CommonCodeUtils.getVideoId(videoUrl.trim())),
referrerLink,
new OnVimeoExtractionListener() {
@Override
public void onSuccess(VimeoVideo video) {
Log.d(TAG, "onSuccess: video : " + video.toString());
Log.d(TAG, "onSuccess: video getStreams : " + video.getStreams());
Log.d(TAG, "onSuccess: video getTitle : " + video.getTitle());
Log.d(TAG, "onSuccess: video getDuration : " + video.getDuration());
Log.d(TAG, "onSuccess: video getStreams: " + video.getStreams());
Log.d(TAG, "onSuccess: video getThumbs : " + video.getThumbs());
Log.d(TAG, "onSuccess: video hasStreams: " + video.hasStreams());
Log.d(TAG, "onSuccess: video hasThumbs : " + video.hasThumbs());
String hdStream = video.getStreams().get("720p");
Log.d(TAG, "onSuccess: stream : " + hdStream);
if (hdStream != null) {
hdStream = hdStream.replace("?source=1", "");
playVideoExoplayer(hdStream);
}
}
@Override
public void onFailure(Throwable throwable) {
//Error handling here
Log.e("failed", "fail" + throwable);
}
});
}