2016-04-08 42 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。 –