S
S
stas82016-01-14 23:45:36
Android
stas8, 2016-01-14 23:45:36

How to implement custom control elements (MediaController) for VideoView?

The VideoView component is used to play a video stream from the network.
Simplified, it looks like this:

final VideoView mVideoView = (VideoView) findViewById(R.id.video_view);
mVideoView.setVideoPath("http://techslides.com/demos/sample-videos/small.mp4");
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(mVideoView);
mVideoView.setMediaController(mediaController);
mVideoView.requestFocus();
mVideoView.setOnPreparedListener(new OnPreparedListener() {
    // Close the progress bar and play the video
    public void onPrepared(MediaPlayer mp) {
        mVideoView.start();
    }
});

How to implement support for custom controls (play/pause buttons, playback indicator, etc.). Restriction: the code must work under API > 15 (i.e. ExoPlayer is not suitable).
Has anyone faced this problem and can you advise?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Dorofeev, 2016-01-15
@stas8

I met with such a
task
:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question