CoDe
CoDe

Reputation: 11146

Display issue while launch Video view Fragment from other fragment?

App State: In one of scenario I created an Video Fragment(with one button over video view) which is launching from existing full screen fragment.

Behaviour Issue: after get lauch VideoFragment blink for a moment and then video view display and start video, While blink it show Wallpaper screen(i.e. to draw Video view it completely remove all view from screen even last display fragment screen also).

What else did: Same scenario checked to launch VideoViewActivity instead of VideoViewFragment but getting same result.

It Can be: Is it issue with VideoView, since here it's drawing VideoView over full screen fragment.

Any suggestion here, how can I fix this issue?

Upvotes: 1

Views: 1087

Answers (2)

CoDe
CoDe

Reputation: 11146

...little trick help me here. Since I am using static video to display, so I Set first frame of video(by extract image from video) as an default BG of Video View and in onPrepare(..)

    public void onPrepared(MediaPlayer mp) {

            mVideoView.start();

            mVideoView.postDelayed(new Runnable() {

                @Override
                public void run() {

                    MainActivity.getInstance().runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            mVideoView.setBackgroundColor(color.transparent);
                            btnSkip.setVisibility(View.VISIBLE);
                            btnSkip.requestFocus(); 
                        }
                    });
                }
            }, 300);
        }

after start Video put delay of some second. and same for onComplete(..).

@Override
    public void onCompletion(MediaPlayer mp) {

        btnSkip.setVisibility(View.GONE);
        mVideoView.setBackgroundColor(getResources().getColor(R.color.bg));
}

It is not feasible solution for multi-video playing scenario.

Upvotes: 1

artemiygrn
artemiygrn

Reputation: 1036

Please write more code, where you start video, and xml of VideoView, what blink color? It may be background color, try use transparent.

Also try use hardware acceleration for VideoView

And in conclusion, i think this is help for you:

VideoView black flash before and after playing

Upvotes: 0

Related Questions