VideoView is closing the application after onresume

I have a custom VideoView as

public class MyVideoView extends VideoView
{
    public int mVideoWidth;
    public int mVideoHeight;

    public MyVideoView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
    }

    public MyVideoView(Context context, AttributeSet attrs, int defStyle)
    {
        super(context, attrs, defStyle);
    }

    public MyVideoView(Context context)
    {
        super(context);
    }

    public void setVideoSize(int width, int height)
    {
        mVideoWidth = width;
        mVideoHeight = height;
        invalidate();
    }

    @Override
    public void setVideoURI(Uri uri)
    {
        MediaMetadataRetriever retriever = new MediaMetadataRetriever();
        retriever.setDataSource(this.getContext(), uri);
        String rotation = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
        if (Integer.parseInt(rotation) == 90)
        {
            mVideoHeight = Integer.parseInt(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
            mVideoWidth  = Integer.parseInt(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
        }
        else
        {
            mVideoWidth = Integer.parseInt(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
            mVideoHeight = Integer.parseInt(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
        }
        super.setVideoURI(uri);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
    {
        // Log.i("@@@", "onMeasure");
        int width = getDefaultSize(mVideoWidth, widthMeasureSpec);
        int height = getDefaultSize(mVideoHeight, heightMeasureSpec);
        if (mVideoWidth > 0 && mVideoHeight > 0)
        {
            if (mVideoWidth * height > width * mVideoHeight)
            {
                height = width * mVideoHeight / mVideoWidth;
            } else if (mVideoWidth * height < width * mVideoHeight)
            {
                width = height * mVideoWidth / mVideoHeight;
            } else
            {
                // Log.i("@@@", "aspect ratio is correct: " +
                // width+"/"+height+"="+
                // mVideoWidth+"/"+mVideoHeight);
            }
        }
        setMeasuredDimension(width, height);
    }
}

The purpose of this VideoView is to resize VideoView according to Video Size

This is my code to initialize VideoView

private void onVideoReady()
    {
        try
        {
            if (cdt != null)
            {
                cdt.cancel();
                cdt = null;
            }

            videoView = (MyVideoView) findViewById(R.id.videoViewPreview);

            if (videoFileName.isEmpty())
            {
                rlPlay.setVisibility(View.GONE);
                ivPlayTemp.setVisibility(View.VISIBLE);
                flVideoPlayer.setBackgroundColor(Color.TRANSPARENT);
            }

            videoView.stopPlayback();
            videoView.setVideoPath(videoFileName);
            videoView.requestFocus();
            videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener()
            {
                @Override
                public void onPrepared(final MediaPlayer mediaPlayer)
                {                         
                    mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener()
                    {
                        @Override
                        public void onCompletion(MediaPlayer mediaPlayer)
                        {
                            if (videoView != null)
                            {
                                mediaPlayer.seekTo(50);
                                videoView.pause();
                                btnPlay.setImageResource(R.drawable.ic_play);

                                tvTotalTime.setText(convertSecondsToMinutes(mediaPlayer.getDuration()));
                                tvRemainingTime.setText(convertSecondsToMinutes(mediaPlayer.getCurrentPosition()));
                                seekBar.setMax(mediaPlayer.getDuration() / 1000);
                                seekBar.setProgress(0);
                            }
                        }
                    });

                    if (videoView != null)
                    {
                        videoView.seekTo(50);
                        videoView.pause();
                        btnPlay.setImageResource(R.drawable.ic_play);

                        tvTotalTime.setText(convertSecondsToMinutes(mediaPlayer.getDuration()));
                        tvRemainingTime.setText(convertSecondsToMinutes(mediaPlayer.getCurrentPosition()));

                        seekBar.setMax(mediaPlayer.getDuration() / 1000);
                        rlPlay.setVisibility(View.VISIBLE);
                        ivPlayTemp.setVisibility(View.GONE);
                        flVideoPlayer.setBackgroundColor(Color.TRANSPARENT);

                        cdt = new CountDownTimer(100000000, 500)
                        {

                            @Override
                            public void onTick(long l)
                            {
                                if (!isClosed)
                                {
                                    if (videoView.isPlaying() && mediaPlayer.isPlaying())
                                    {
                                        int mCurrentPosition = videoView.getCurrentPosition() / 1000;
                                        seekBar.setProgress(mCurrentPosition);
                                    }
                                }
                            }

                            @Override
                            public void onFinish()
                            {

                            }
                        };
                        cdt.start();

                        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
                        {

                            @Override
                            public void onStopTrackingTouch(SeekBar seekBar)
                            {
                            }

                            @Override
                            public void onStartTrackingTouch(SeekBar seekBar)
                            {
                            }

                            @Override
                            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
                            {
                                if (fromUser)
                                {
                                    mediaPlayer.seekTo(progress * 1000);
                                }
                                if (videoView != null)
                                {
                                    tvTotalTime.setText(convertSecondsToMinutes(videoView.getDuration()));
                                    tvRemainingTime.setText(convertSecondsToMinutes(videoView.getCurrentPosition()));
                                }
                            }
                        });
                    }

                }
            });
        } catch (Exception e)
        {
            e.printStackTrace();
        }

    }

When i open my activity it works fine, However at some point if activity goes to onPause and returns to onResume, and then i try to play the video, it plays for 1 second and then the application closes. There is NO error in log , There is no popup saying Force Close. It just closes the application

A tester found this error in console but not sure if this is related to this specific bug

/MediaFocusControl: Failure to signal gain of audio focus due to: 
                                                   android.os.DeadObjectException
                                                       at android.os.BinderProxy.transactNative(Native Method)
                                                       at android.os.BinderProxy.transact(Binder.java:504)
                                                       at android.media.IAudioFocusDispatcher$Stub$Proxy.dispatchAudioFocusChange(IAudioFocusDispatcher.java:85)
                                                       at android.media.FocusRequester.handleFocusGain(FocusRequester.java:219)
                                                       at android.media.MediaFocusControl.notifyTopOfAudioFocusStack(MediaFocusControl.java:446)
                                                       at android.media.MediaFocusControl.removeFocusStackEntryForClient(MediaFocusControl.java:540)
                                                       at android.media.MediaFocusControl.access$1800(MediaFocusControl.java:70)
                                                       at android.media.MediaFocusControl$AudioFocusDeathHandler.binderDied(MediaFocusControl.java:571)
                                                       at android.os.BinderProxy.sendDeathNotice(Binder.java:559)

Anyone can shed light what is going on?