2016-04-08 39 views
0

我正在创建一个Android应用程序,我想玩以及从BrightCove下载视频现在的问题是BrightCove有其自己的球员,即com.brightcove.player.view.BrightcoveExoPlayerVideoView我不能使用。我必须在Android Native MediaPlayer中播放视频。获取BrightCove视频的网址下载和流

我检查所有的文档和那里,他们只有再次提供一些像这样的事情,并再次

EventEmitter eventEmitter = brightcoveVideoView.getEventEmitter(); 
    Catalog catalog = new Catalog(eventEmitter, getString(R.string.account), getString(R.string.policy)); 

    catalog.findVideoByID(getString(R.string.videoId), new VideoListener() { 

     // Add the video found to the queue with add(). 
     // Start playback of the video with start(). 
     @Override 
     public void onVideo(Video video) { 
      brightcoveVideoView.add(video); 
      brightcoveVideoView.start(); 
     } 

     @Override 
     public void onError(String s) { 
      throw new RuntimeException(s); 
     } 
    }); 

我怎么能得到确切的URL播放和下载?

当搜索在Brightcove的视频使用servercalls/API_tester返回一些这方面

{ “ID”:1520880903001, “名”: “空间银河”, “adKeys”:空,“SHORTDESCRIPTION “: ”作为试样进行访问视频内容与 媒体API - 不删除“, ”longDescription“:空,
”creationDate“: ”1332264917716“, ”publishedDate“: ”1332264917716“,
” lastModifiedDate “:”1441607273772“,”linkURL“: ”http://support.brightcove.com/en/docs/accessing-video-content-media-api“, ”linkText“:”使用媒体API访问视频内容“ , “标签”:[ “newtag”], “videoStillURL”: “http://brightcove.vo.llnwd.net/e1/pd/57838016001/57838016001_1520916808001_vs-1520911645001.jpg?pubId=57838016001”, “thumbnailURL”: “http://brightcove.vo.llnwd.net/e1/pd/57838016001/57838016001_1520916809001_th-1520911645001.jpg?pubId=57838016001”, “referenceId”: “1520880903001”, “长度”:20000, “经济”: “AD_SUPPORTED”,“playsTotal”:102,“playsTrailingWeek”:0,
“FLVURL”: “rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/ & mp4:57838016001 /57838016001_1520916807001_Space-Galaxy.mp4 a99dcabb0f88cdf8d21b3a5778da8e06" , “移交”:[{ “audioOnly”:假, “controllerType”: “DEFAULT”, “显示名”: “空间Galaxy.mp4”, “encodingRate”:800000 “frameHeight”:360, “frameWidth”:640, “ID”:1520959065001, “referenceId”:空, “ remoteStreamName “:空, ”remoteUrl“:空, ”大小“:1829449, ”uploadTimestampMillis“:1332267195355, ”URL“:” RTMP://brightcove.fcod.llnwd.net/a500/e1/uds/ RTMP /按需/ & MP4:57838016001/57838016001_1520959065001_Space-Galaxy.mp4 a99dcabb0f88cdf8d21b3a5778da8e06" , “VIDEOCODEC”: “H264”, “videoContainer”: “MP4”, “videoDuration”:20000 },{ “audioOnly”:假的, “controllerType”: “DEFAULT”, “显示名”: “空间Galaxy.mp4”, “encodingRate”:180万, “frameHeight “:720, “frameWidth”:1280, “ID”:1520962209001, “referenceId”:空, “remoteStreamName”:空, “remoteUrl”:空, “大小”:4265519, “uploadTimestampMillis” :1332267361480, “url”:“rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/ & mp4:57838016001/57838016001_1520962209001_Space-Ga laxy。MP4 a99dcabb0f88cdf8d21b3a5778da8e06" , “VIDEOCODEC”: “H264”, “videoContainer”: “MP4”, “videoDuration”:20000 }, { “audioOnly”:假, “controllerType”:“DEFAULT ” “显示名”: “空间Galaxy.mp4”, “encodingRate” 120万, “frameHeight”:404, “frameWidth”:720, “ID”:1520962169001, “referenceId”:空, “remoteStreamName”:null, “remoteUrl”:null, “size”:2777863, “uploadTimestampMillis”:1332267330633, “URL”: “RTMP://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/ & MP4:57838016001/57838016001_1520962169001_Space-Galaxy.mp4 a99dcabb0f88cdf8d21b3a5778da8e06” , “VIDEOCODEC”: “H264”, “videoContainer”: “MP4”, “videoDuration”:20000 }, { “audioOnly”:假, “controllerType”: “DEFAULT”, “显示名” :“Space-Galaxy.mp4”, “encodingRate”:314758, “frameHeight”:224, “frameWidth”:400, “ ID “:1520959023001, ”referenceId“:空, ”remoteStreamName“:空, ”remoteUrl“:空, ”大小“:690193, ”uploadTimestampMillis“:1332267165343, ”URL“:” RTMP:// brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/ & MP4:57838016001/57838016001_1520959023001_Space-Galaxy.mp4 a99dcabb0f88cdf8d21b3a5778da8e06" , “VIDEOCODEC”: “H264”, “videoContainer”:“MP4 “, ”videoDuration“:20000 }, { ”audioOnly“:false, ”controllerType“:”DEFAULT“, “显示名”: “空间Galaxy.mp4”, “encodingRate”:500000 “frameHeight”:268, “frameWidth”:480, “ID”:1520916807001, “referenceId”:空, “ remoteStreamName “:空, ”remoteUrl“:空, ”大小“:1126642, ”uploadTimestampMillis“:1332265138822, ”URL“:” RTMP://brightcove.fcod.llnwd.net/a500/e1/uds/ RTMP /按需/ & MP4:57838016001/57838016001_1520916807001_Space-Galaxy.mp4 a99dcabb0f88cdf8d21b3a5778da8e06" , “VIDEOCODEC”: “H264”, “videoContainer”: “MP4”, “videoDuration”:20000 },{ “audioOnly”:假的, “controllerType”: “DEFAULT”, “显示名”: “空间Galaxy.mp4”, “encodingRate”:129761, “frameHeight “:224, “frameWidth”:400, “ID”:1520953533001, “referenceId”:空, “remoteStreamName”:空, “remoteUrl”:空, “大小”:227983, “uploadTimestampMillis” :1332266955420, “url”:“rtmp://brightcove.fcod.llnwd。净/ A500/E1/UDS/RTMP /按需/ & MP4:57838016001/57838016001_1520953533001_Space-Galaxy.mp4 a99dcabb0f88cdf8d21b3a5778da8e06" , “VIDEOCODEC”: “H264”, “videoContainer”: “MP4”, “videoDuration” :20134 }], “FLVFullLength”:{ “audioOnly”:假, “controllerType”: “DEFAULT”, “显示名”: “空间Galaxy.mp4”, “encodingRate”:500000, “frameHeight “:268, ”frameWidth“:480, ”id“:1520916807001, ”referenceId“:null, ”remoteStreamName“:null, “remoteUrl”:空, “大小”:1126642, “uploadTimestampMillis”:1332265138822, “URL”:“RTMP://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/ & MP4:57838016001/57838016001_1520916807001_Space-Galaxy.mp4 a99dcabb0f88cdf8d21b3a5778da8e06" , “VIDEOCODEC”: “H264”, “videoContainer”: “MP4”, “videoDuration”:20000}, “videoFullLength”:{ “audioOnly” :false, “controllerType”:“DEFAULT”, “displayName”:“Space-Galaxy.mp4”, “encodingRate”:500000, “frameHeight”:268, “frameWidth”:480, “ID”:1520916807001, “referenceId”:空, “remoteStreamName”:空, “remoteUrl”:空, “大小”:1126642, “uploadTimestampMillis”:1332265138822, “URL”:“RTMP: //brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/ & MP4:57838016001/57838016001_1520916807001_Space-Galaxy.mp4 a99dcabb0f88cdf8d21b3a5778da8e06" , “VIDEOCODEC”: “H264”, “videoContainer”: “MP4”, “videoDuration”:20000}}

它有像

RTMP一些链接://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/ & MP4:57838016001/57838016001_1520959023001_Space-Galaxy.mp4 a99dcabb0f88cdf8d21b3a5778da8e06

但MediaPlayer上没有播放任何内容。可能是因为rtmprmtp我可能不得不使用Vitamio但我不能,因为我限制使用本机的MediaPlayer。

在IOS我能够用得到的URL:BCOVPlaybackService但有没有这样的类机器人。

感谢

回答

2

好了这是怎么我得到URL

EventEmitter eventEmitter = player.getEventEmitter(); 
      Catalog catalog = new Catalog(eventEmitter, account, privacy); 
      catalog.findVideoByID(video_brightcove_id, new VideoListener() { 
       @Override 
       public void onVideo(Video video) { 

        Map<DeliveryType, SourceCollection> map = video.getSourceCollections(); 
        Set<DeliveryType> st = map.keySet(); 
        SourceCollection sor = map.get(DeliveryType.valueOf("MP4")); 
        Set<Source> se = sor.getSources(); 
        Object[] ar = se.toArray(); 
        Source hp = (Source) ar[0]; 
        Map<String, Object> ma = hp.getProperties(); 
        String url = (String) ma.get("url"); 
       ////this is the video url 

       } 

       @Override 
       public void onError(String s) { 

        Log.e("Error ", s); 
       } 
      }); 

谢谢:)

+0

会是怎样的DRM保护的内容的情况下?它是否也包含交付类型为MP4 –

+0

不确定原因,但是它包含交付类型为MP4。 –