5

I have learn how to resize video playing on this Full screen videoview without stretching the video .

With gameowner answer, it works. And it also force to keep aspect radio such that it will end up with black stripes in the sides.

I would like to have another optional. That is I do not want to have black stripes in the sides. I would like the video height is still remain in screen height. To keep aspect radio, the video width should greater than screen width. It doesn't matter that I cannot watch the "most left part" and "most right part" of video. I think I just need to change from:

if (videoProportion > screenProportion) {
        lp.width = screenWidth;
        lp.height = (int) ((float) screenWidth / videoProportion);
} else {
        lp.width = (int) (videoProportion * (float) screenHeight);
        lp.height = screenHeight;
}

to

if (videoProportion < screenProportion) {
        lp.width = screenWidth;
        lp.height = (int) ((float) screenWidth / videoProportion);
} else {
        lp.width = (int) (videoProportion * (float) screenHeight);
        lp.height = screenHeight;
}

would be ok but I didn't. Once the surfaceView size is larger than the screen. This just show black screen but keep aduio playing.

I also try to take surfaceview holder fixed size into account:

surfaceViewFrame.getHolder().setFixedSize(lp.width, lp.height);

but it does not solve the problem. Is it possible to play video which size is greater than screen?

Edit: OK. I have realized that the term of my question. I would like to zoom-in my video in aspect radio and but in fullscreen. Also known as crop video to fullscreen.

I tried to use TextureView inside a FrameLayout (required) container: Playing video on TextureView I have Android 4.0 devices that work fine in this workaround but I am not sure it really work on other 4.0 devices. Also TextureView is Android 4.0 or above only. I would be grateful if there is workaround for Android 2.x.

Community
  • 1
  • 1
Yeung
  • 2,202
  • 2
  • 27
  • 50
  • Hey, I have the same problem, did you manage to get this? – shem Feb 06 '13 at 17:00
  • @shem. No. For Android 4 or above, we can use `TextureView` and resize it like normal view system. Or we can pre-process the video file first (like using [this](http://www.wondershare.com/video-editor/)), then load into android device. – Yeung Feb 07 '13 at 02:49
  • 1
    Testing on modern device will not have this kind of issue. – Yeung Mar 20 '15 at 08:21

0 Answers0