0

I am implementing Video View in android and I am also using MediaController. When the video is playing media controller is not hidden after few seconds. This is my code,

    layoutVideoFrame = (FrameLayout) findViewById(R.id.videoFrame);
    videoPlayerView = (VideoView) findViewById(R.id.videoPlayerView);
    mediaController = new MediaController(this);


    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.BOTTOM;
    mediaController.setLayoutParams(lp);
    ((ViewGroup) mediaController.getParent()).removeView(mediaController);
    layoutVideoFrame.addView(mediaController);

    getWindowManager().getDefaultDisplay().getMetrics(dm);
    int width = dm.widthPixels;
    LayoutParams params = (LayoutParams) videoPlayerView.getLayoutParams();
    height = params.height;
    params.width = width;
    videoPlayerView.setLayoutParams(params);
    videoPlayerView.setMediaController(mediaController);

How to hide media controller after few seconds and comes back when the user touches the screen?

chathura
  • 3,362
  • 6
  • 41
  • 68
  • why r u using this line mediaController.setLayoutParams(lp); – Dilip Nov 05 '14 at 06:44
  • media controller displayed after the video view. to avoid that I used that. (it should display on the view but at the bottom) :- check the last answer http://stackoverflow.com/questions/3686729/mediacontroller-positioning-over-videoview – chathura Nov 05 '14 at 06:47

0 Answers0