try to create a small surface of the video or video and you can change the presentation parameter by the display matrix
DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int height = displaymetrics.heightPixels; int width = displaymetrics.widthPixels; android.widget.FrameLayout.LayoutParams params = (android.widget.FrameLayout.LayoutParams) videoSurface.getLayoutParams(); params.width = width; params.height=height-80;
So, to execute this code, you can create your own custom media controller or use the binding binding by expanding the media controller.
1) Here is the link to the user media controller User media controller
2) expand the media controller and set the tag binding set tag binding
public void setAnchorView(final View view) { super.setAnchorView(view); Button fullScreen = new Button(context); fullScreen.setText("FullScreen"); Log.e("media controller","Set anchorView"); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.setMargins(view.getWidth(), 0, 5, 20); params.gravity = Gravity.RIGHT; addView(fullScreen, params); fullScreen.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) {
source share