标签:android surface videoplayer zoom
不直接改变Codec输出的视频宽高比,而是改变视频播放器窗口的大小。
需要将Window设置未可以超出屏幕尺寸
mWindow.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
mSurfaceHolder.setFixedSize(mVideoWidth, mVideoHeight);
ViewGroup.LayoutParams layoutParams = (ViewGroup.LayoutParams) mSurface.getLayoutParams(); if (scale > 4.0f) { scale = 4.0f; } else if (scale < 0.25f) { scale = 0.25f; } layoutParams.width = (int) (windowWidth * scale); layoutParams.height = (int) (windowHeight * scale); mSurface.setLayoutParams(layoutParams);
标签:android surface videoplayer zoom
原文地址:http://blog.csdn.net/matrix_laboratory/article/details/44245487