Получить URL-адрес видео BrightCove для загрузки и потокового
Я создаю приложение для Android, в котором я хочу играть, а также загружать видео с BrightCove, теперь проблема в том, что у BrightCove есть собственный плеер, т.е. com.brightcove.player.view.BrightcoveExoPlayerVideoView
Что я не мог использовать. Я должен воспроизвести видео в Android Native 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 для воспроизведения и загрузки?
При поиске видео в BrightCove с использованием servercalls/API_tester он возвращает это
{ "id": 1520880903001, "name": "Space-Galaxy", "adKeys": null, "shortDescription": "Используется в качестве примера для доступа к видеоконтенту с помощью Media API - НЕ УДАЛЯТЬ", "longDescription": ноль,
"creationDate": "1332264917716", "ОпубликовалДата": "1332264917716",
"lastModifiedDate": "1441607273772", "linkURL": " http://support.brightcove.com/en/docs/accessing-video-content-media-api", "linkText": "Доступ к видеоконтенту с помощью Media API "," tags ": [" newtag "]," videoStillURL ":" http://brightcove.vo.llnwd.net/e1/pd/57838016001/57838016001_1520916808001_vs-1520911645001.jpg?pubId=57838016001"," thumbUR " http://brightcove.vo.llnwd.net/e1/pd/57838016001/57838016001_1520916809001_th-1520911645001.jpg?pubId=57838016001", "referenceId": "1520880903001", "length": 20000, ADUP "SPS": "," playsTotal ": 102," playsTrailingWeek ": 0,
"FLVURL": "rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520916807001_Space-Galaxy.mp4 & 1460095200000 & a99dcabb0da_0808" "controllerType": "DEFAULT", "displayName": "Space-Galaxy.mp4", "encodingRate": 800000, "frameHeight": 360, "frameWidth": 640, "id": 1520959065001, "referenceId": null, "remoteStreamName": null, "remoteUrl": null, "size": 1829449, "uploadTimestampMillis": 1332267195355, "url": "rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520959065001_Space-Galaxy.mp4&1460095200000&a99dcabb0f88cdf8d21b3a5778da8e06", "videoCodec": "H264", "videoContainer": "MP4", " false ": 20000:" Да ": 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005A8778da8e06 "displayName": "Space-Galaxy.mp4", "encodingRate": 1800000, "frameHeight": 720, "frameWidth": 1280, "id": 1520962209001, "referenceId": null, "remoteStreamName": null, "remoteUrl": null, "size": 4265519, "uploadTimestampMillis": 1332267361480, "url": "rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520962209001_Space-Galaxy.mp4 & 14ab050505 "hd5605" 6006505 "6006", "videoContainer": "MP4", "videoDuration": 20000 }, { "audioOnly": false, "controllerType": "DEFAULT", "displayName": "Space-Galaxy.mp4", "encodingRate": 1200000, " frameHeight ": 404, "frameWidth": 720," id ": 1520962169001," referenceId ": null," 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&1460095200000&a99dcabb0f88cdf8d" "видео, "videoDuration": 20000}, {"audioOnly": false, "controllerType": "DEFAULT", "displayName": "Space-Galaxy.mp4", "encodingRate": 314758, "frameHeight": 224, "frameWidth": 400, "id": 1520959023001, "см. enceId ": null," remoteStreamName ": null," remoteUrl ": null," size ": 690193, "uploadTimestampMillis": 1332267165343," url ":" rtmp: //brightcove.fcod.llnwd.net/a500/e1/ uds / rtmp / ondemand / & mp4: 57838016001 / 57838016001_1520959023001_Space-Galaxy.mp4 & 1460095200000 & a99dcabb0f88cdf8d21b3a5778da8e06 "," videoCodec ":" H264 ", videoT: "DEFAULT", "displayName": "Space-Galaxy.mp4", "encodingRate": 500000, "frameHeight": 268, "frameWidth": 480, "id": 1520916807001, "referenceId": null, "remoteStreamName": null, "remoteUrl": null, "size": 1126642, "uploadTimestampMillis": 1332265138822, "url": "rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520916807001_Space-Galaxy.mp4 & 1460095200000 & a99dcabb0f88cdf8d21b3a5778da8e06 "," videoCodec ":" H264 "," videoContainer ":" MP4 ", displaying, audioDuration:" falseN ":" false "" ": TAL:" FALT ": false" ": TAL:" FALT ": false" ": FALT": false ":" DAL ":" DAL ":" DAL ":" DAL ":" DAL ":" DAL ":" DAL ":" DAL ":" DAL ":" DALT ":" DAL ":" DAL ":" DAL ":" DAL ":" DNT ":" DAL ":" DAL ":" DALT ": "Space-Galaxy.mp4", "encodi ngRate ": 129761," frameHeight ": 224, "frameWidth": 400," id ": 1520953533001," referenceId ": null," remoteStreamName ": null," remoteUrl ": null," size ": 227983," uploadTimestampMillis ": 1332266955420, "url": "rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520953533001_Space-Galaxy.mp4 & 1460095200000 & hd0508" videoContainer ":" MP4 "," videoDuration ": 20134}]," FLVFullLength ": { "audioOnly": false, "controllerType": "DEFAULT", "displayName": "Space-Galaxy.mp4", "encodingRate": 500000, "frameHeight": 268, "frameWidth": 480, "id": 1520916807001, "referenceId": null, "remoteStreamName": null, "remoteUrl": null, "size": 1126642, "uploadTimestampMillis": 1332265138822, "url": "rtmp://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520916807001_Space-Galaxy.mp4&1460095200000&a99dcabb0f88c" видеобайфайл ":" видеоконференция " "MP4", "videoDuration": 20000}, "videoFullLength": {"audioOnly": false, "controllerType": "DEFAULT", "displayName": "Space-Galaxy.mp4", "encodingRate": 500000, "frameHeight": 268, "frameWidth": 480, "id": 1520916807001, "referenceId": null, "remoteStreamName": null, "remoteUrl": null, "size": 1126642, "uploadTimestampMillis": 1332265138822, "url": "rtmp: //brightcove.fcod,
Он имеет несколько ссылок, таких как
RTMP://brightcove.fcod.llnwd.net/a500/e1/uds/rtmp/ondemand/&mp4:57838016001/57838016001_1520959023001_Space-Galaxy.mp4 & 1460095200000 & a99dcabb0f88cdf8d21b3a5778da8e06
но на MediaPlayer ничего не воспроизводится. Может быть из-за rtmp
и для rmtp
Возможно, мне придется использовать Vitamio, но я не могу, поскольку я ограничен в использовании собственного MediaPlayer.
На IOS я могу получить URL с помощью: BCOVPlaybackService
Но в андроиде такого класса нет.
Спасибо
1 ответ
Хорошо, вот как я получаю 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);
}
});
Спасибо:)