Android 获取BrightCove视频的URL以供下载和流式传输
我正在创建一个android应用程序,我想在其中播放以及从BrightCove下载视频。现在问题是BrightCove有自己的播放器,即Android 获取BrightCove视频的URL以供下载和流式传输,android,video,rtmp,brightcove,Android,Video,Rtmp,Brightcove,我正在创建一个android应用程序,我想在其中播放以及从BrightCove下载视频。现在问题是BrightCove有自己的播放器,即com.BrightCove.player.view.BrightcoveXoplayerVideoView,我无法使用。我必须用Android原生MediaPlayer播放视频 我已经检查了所有的文件,在那里他们只提供了一些这样的东西一次又一次 EventEmitter eventEmitter = brightcoveVideoView.getEvent
com.BrightCove.player.view.BrightcoveXoplayerVideoView
,我无法使用。我必须用Android原生MediaPlayer播放视频
我已经检查了所有的文件,在那里他们只提供了一些这样的东西一次又一次
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
当使用servercalls/API_tester在BrightCove上搜索视频时,它会返回一些
{“id”:1520880903001,“name”:“Space Galaxy”,“adKeys”:null,“shortDescription”:“用作访问视频内容的示例”
媒体API--不删除“,”longDescription“:null,“creationDate”:“1332264917716”,“publishedDate”:“1332264917716”,
“lastModifiedDate”:“1441607273772”,“链接URL”: "", “链接文本”:“使用媒体API访问视频内容”,“标记”:[ “newtag”],“videoStillURL”:“, “缩略图URL”: "", “参考ID”:“1520880903001”,“长度”:20000,“经济学”: “支持广告”、“playsTotal”:102、“playsTrailingWeek”:0,
“FLVURL”: "rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520916807001_Space-Galaxy.mp4&1460095200000&a99dcabb0f88cdf8d21b3a5778da8e06“, “格式副本”:[ { “仅限音频”:错误, “控制器类型”:“默认值”, “displayName”:“spacegalaxy.mp4”, “编码率”:800000, “帧高”:360, “帧宽”:640, “id”:1520959065001, “referenceId”:null, “remoteStreamName”:空, “remoteUrl”:空, “大小”:1829449, “上载时间戳”:1332267195355, “url”:”rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520959065001_Space-Galaxy.mp4&1460095200000&a99dcabb0f88cdf8d21b3a5778da8e06“, “视频编解码器”:“H264”, “videoContainer”:“MP4”, “视频持续时间”:20000 }, { “仅限音频”:错误, “控制器类型”:“默认值”, “displayName”:“spacegalaxy.mp4”, “编码率”:1800000, “帧高”:720, “帧宽度”:1280, “id”:1520962209001, “referenceId”:null, “remoteStreamName”:空, “remoteUrl”:空, “尺寸”:4265519, “上载时间戳”:1332267361480, “url”:”rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520962209001_Space-Galaxy.mp4&1460095200000&a99dcabb0f88cdf8d21b3a5778da8e06“, “视频编解码器”:“H264”, “videoContainer”:“MP4”, “视频持续时间”:20000 }, { “仅限音频”:错误, “控制器类型”:“默认值”, “displayName”:“spacegalaxy.mp4”, “编码率”:1200000, “框架高度”:404, “帧宽”:720, “id”:1520962169001, “referenceId”:null, “remoteStreamName”:空, “remoteUrl”:空, “尺寸”:2777863, “上载时间戳”:1332267330633, “url”:”rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520962169001_Space-Galaxy.mp4&1460095200000&a99dcabb0f88cdf8d21b3a5778da8e06“, “视频编解码器”:“H264”, “videoContainer”:“MP4”, “视频持续时间”:20000 }, { “仅限音频”:错误, “控制器类型”:“默认值”, “displayName”:“spacegalaxy.mp4”, “编码率”:314758, “框架高度”:224, “帧宽”:400, “id”:1520959023001, “referenceId”:null, “remoteStreamName”:空, “remoteUrl”:空, “尺寸”:690193, “上载时间戳”:1332267165343, “url”:”rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520959023001_Space-Galaxy.mp4&1460095200000&a99dcabb0f88cdf8d21b3a5778da8e06“, “视频编解码器”:“H264”, “videoContainer”:“MP4”, “视频持续时间”:20000 }, { “仅限音频”:错误, “控制器类型”:“默认值”, “displayName”:“spacegalaxy.mp4”, “编码率”:500000, “框架高度”:268, “帧宽度”:480, “id”:1520916807001, “referenceId”:null, “remoteStreamName”:空, “remoteUrl”:空, “尺寸”:1126642, “上载时间戳”:1332265138822, “url”:”rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520916807001_Space-Galaxy.mp4&1460095200000&a99dcabb0f88cdf8d21b3a5778da8e06“, “视频编解码器”:“H264”, “videoContainer”:“MP4”, “视频持续时间”:20000 }, { “仅限音频”:错误, “控制器类型”:“默认值”, “displayName”:“spacegalaxy.mp4”, “编码率”:129761, “框架高度”:224, “帧宽”:400, “id”:15209533001, “referenceId”:null, “remoteStreamName”:空, “remoteUrl”:空, “尺寸”:227983, “UploadTimestampillis”:133226655420, “url”:”rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520953533001_Space-Galaxy.mp4&1460095200000&a99dcabb0f88cdf8d21b3a5778da8e06“, “视频编解码器”:“H264”, “videoContainer”:“MP4”, “视频持续时间”:20134 }],“FLVFullLength”:{ “仅限音频”:错误, “控制器类型”:“默认值”, “displayName”:“spacegalaxy.mp4”, “编码率”:500000, “框架高度”:268, “帧宽度”:480, “id”:1520916807001, “referenceId”:null, “remoteStreamName”:空, “remoteUrl”:空, “尺寸”:1126642, “上载时间戳”:1332265138822, “url”:”rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:5
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);
}
});