Show MediaPlayer buffering in search bar as secondary progress

I am using Video view to stream HLS stream from wowza media server. I want to show general buffering in the same way as in the YouTube player that I did, and I can access the search object and I was debugging the code, notnull

videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                int topContainerId = getResources().getIdentifier("mediacontroller_progress", "id", "android");
                seekbar = (SeekBar) mediaController.findViewById(topContainerId);

                mp.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {
                    @Override
                    public void onBufferingUpdate(MediaPlayer mp, int percent) {
                        if (percent<seekbar.getMax()) {
                            seekbar.setSecondaryProgress(percent);  
                        }
                    }
                });
            }
        }); 

The problem is that I do not see any additional progress in the search bar of the multimedia controller. If any clarification is required, please write in the comments. Help is really appreciated.

+5
source share
2 answers

Use below code and you goog to go

videoView.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                int topContainerId = getResources().getIdentifier("mediacontroller_progress", "id", "android");
                seekbar = (SeekBar) mediaController.findViewById(topContainerId);

                mp.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {
                    @Override
                    public void onBufferingUpdate(MediaPlayer mp, int percent) {
                        if (percent<seekbar.getMax()) {
                            seekbar.setSecondaryProgress(percent);  
                            seekbar.setSecondaryProgress(percent/100);  
                        }
                    }
                });
            }
        }); 
+8
source

, . , .

mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() {
        @Override
        public void onBufferingUpdate(MediaPlayer mediaPlayer, int percent) {
            double per = percent * 1.00;
            per = (per / 100);
            double f = (seekBar.getMax() * 1.00);
            f = f * per;
            if (percent < binder.seekBar.getMax()) {
                seekBar.setSecondaryProgress((int) f);
            }
        }
    });

int double , int 100 0, 0.12 0.xx.

0

All Articles