Code example for MediaController

Methods: setAnchorView, setEnabled, setMediaPlayer

0
        return mMediaController;
    } 
 
    private void attachMediaController() { 
        if (mMediaPlayer != null && mMediaController != null) {
            mMediaController.setMediaPlayer(this);
            View anchorView = this.getParent() instanceof View ?
                    (View)this.getParent() : this;
            mMediaController.setAnchorView(anchorView);
            mMediaController.setEnabled(isInPlaybackState());
        } 
    } 
 
    MediaPlayer.OnVideoSizeChangedListener mSizeChangedListener =
        new MediaPlayer.OnVideoSizeChangedListener() { 
            public void onVideoSizeChanged(MediaPlayer mp, int width, int height) { 
                mVideoWidth = mp.getVideoWidth(); 
                mVideoHeight = mp.getVideoHeight(); 
                if (mVideoWidth != 0 && mVideoHeight != 0) { 
                    getHolder().setFixedSize(mVideoWidth, mVideoHeight); 
                }