How to add pending intent in notification BrightCoveOS

28 Views Asked by At

How to add pending intent when someone clicks in download notification in BrightCoveOS Android.

I used MediaDownloadable object for requesting download video in BrightCoveOS and I want to hide default notification provided by BrightCoveOS and want to add my own custom notification. For achieving this i used RequestConfig setNotificationVisibilty method but this didn't works.

And i also work with PlayerNotification manager but I'd didn't understand how to use this with BrightCoveOS android.

Here is my code (1st way downloading video without adding hiding notification code)

catalog.getMediaFormatTracksAvailable(video, (mediaDownloadable, bundle) -> {
         List<MediaFormat> list = bundle.getParcelableArrayList(MediaDownloadable.VIDEO_RENDITIONS);
         if (list != null) {
             brightCoveQualityHolders.clear();
             int bitrate = 0;
             for (MediaFormat media : list) {
                 brightCoveQualityHolders.add(new BrightCoveQualityHolder(media.width, media.height, media.bitrate));
                 if (media.height == 360) {
                     bitrate = media.bitrate;
                 }
                 String msg = "width " + media.width + " height " + media.height + " bitrate " + media.bitrate;
                 Log.d(TAG,msg);
             }
             catalog.setVideoBitrate(bitrate);

             getVideo(video, new OfflineCallback<>() {
                 @Override
                 public void onSuccess(Video video1) {
                     if (video1.isClearContent()) {
                         videoListListener.downloadVideo(video1);
                     }
                 }

                 @Override
                 public void onFailure(Throwable throwable) {

                 }
             });
        });

2nd way (hiding notification (not work) with downloading work but some times not)

 catalog.findVideoByID(brightCoveVideoId, new VideoListener() {
 @Override
 public void onVideo(Video video) {
     mediaDownloadable = MediaDownloadable.create(context, video, downloadEventListener, new RequestConfig().setNotificationVisibility(RequestConfig.VISIBILITY_HIDDEN));
     mediaDownloadable.requestDownload();
     String name = allRecordModel.getTitle();
     video.getProperties().put(Video.Fields.NAME, name);
     progressDialog.show();
 }

});

0

There are 0 best solutions below