如何在Android Native Player中播放Vimeo视频

时间:2020-10-25 17:29:05

标签: android vimeo vimeo-api vimeo-player vimeo-android

我想在Android本机播放器中播放vimeo视频。我有vimeo PRO。 在vimeo文档中,提供了以下代码,可以在本机播放

Video video = ...; // obtain a video you own as described above
Play play = video.getPlay();
if (play != null) {
     VideoFile dashFile = play.getDashVideoFile();
     String dashLike = dashFile.getLink();
     // load link
     
     VideoFile hlsFile = play.getHlsVideoFile();
     String hlsLink = hlsFile.getLink();
     // load link
     
     ArrayList<VideoFile> progressiveFiles = play.getProgressiveVideoFiles();
     // pick a progressive file to play
} 

但是当我尝试时, video.getPlay()返回null

这是我的代码

VimeoClient.getInstance().fetchNetworkContent(uri, new ModelCallback<Video>(Video.class) {
   @Override
   public void success(Video video) {
         Play play = video.getPlay();  // **returning null**
         if (play != null) {

              VideoFile hlsFile = play.getHlsVideoFile();
              String hlsLink = hlsFile.getLink();
              // load link
              initializePlayer(hlsLink);
         }
    }

   @Override
   public void failure(VimeoError error) {
         // voice the error
         Log.d(TAG, "failure: ");
   }
}

Is there anything i am doing wrong ? or is there any other way to play vimeo videos?

0 个答案:

没有答案