playback video full screen

前端 未结 5 1915
无人及你
无人及你 2020-11-27 16:51

I am trying to play a video in my app. It has to be embedded.

I went through the \"Play Video Files in Android\" thread.

I am able to play my video using Vi

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 17:14

    I have solved the problem:

    1. To remove the continue/pause buttons remove the media controller. For the looping issue put OnCompletionListener so that when the video reaches the end, it starts again:

    videoView.setOnCompletionListener(
            new MediaPlayer.OnCompletionListener() {
            public void onCompletion(MediaPlayer mp) {
                videoView.start();
            }
            });
    

    2. To resize the video, override method onMeasure() in VideoView like this:

    public class MyVideoView extends VideoView {
    
            public MyVideoView(Context context) {
                super(context);
            }
    
            @Override
            protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
            {
                 setMeasuredDimension(480,800);
            }
    
        }
    

提交回复
热议问题