开发者

how to Remove white space while streaming video in videoview?

开发者 https://www.devze.com 2023-04-03 14:04 出处:网络
I am trying to stream video in video view over HTTP. and my code is as shown below. I am getting a white space between the video. I want to play video in whole screen ... can anyone suggest what to do

I am trying to stream video in video view over HTTP. and my code is as shown below. I am getting a white space between the video. I want to play video in whole screen ... can anyone suggest what to do?

MediaController mc = new MediaController(VideoViewActivity.this);
mc.setAnchorView(mVideoView);
mc.开发者_开发技巧setMediaPlayer(mVideoView);
Uri video = Uri.parse(path);
mVideoView.requestFocus();
mVideoView.setMediaController(mc);
mVideoView.setVideoURI(video);
mVideoView.start();

This is how i have coded to play the video. Below Image shows while space.

how to Remove white space while streaming video in videoview?


Set this for your VideoView

    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"


set it programmatically

videoView.setVideoURI(Uri.parse(url))

     val metrics = DisplayMetrics()
            windowManager.defaultDisplay.getMetrics(metrics)
            videoView.layoutParams = RelativeLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels)

videoView.start()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号