1

我正在尝试在游戏结束时播放视频,我正在使用 videoview,但是当我播放该视频时,黑色屏幕会出现几毫秒。请建议解决这个问题。有没有其他方法可以在 andengin 中播放视频

@Override
        protected void onSetContentView() {

                RelativeLayout layout = new RelativeLayout(this);

                renderView = new RenderSurfaceView(this);

                RelativeLayout.LayoutParams renderViewparams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
                                LayoutParams.FILL_PARENT);
                renderViewparams.addRule(RelativeLayout.CENTER_IN_PARENT, 0);
                vView= new VideoView(this);

                RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,
                                LayoutParams.FILL_PARENT);
                params.addRule(RelativeLayout.CENTER_IN_PARENT, 0);
                params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
                params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
                params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
                params.addRule(RelativeLayout.ALIGN_PARENT_TOP);

                vView.setVideoURI(Uri.parse("android.resource://com.rovolt/"+R.raw.tiggoutest));
                vView.setVisibility(View.GONE);
                vView.setOnCompletionListener(new MediaPlayer.OnCompletionListener()
                {          
                        public void onCompletion(MediaPlayer mp)
                        {
                                // Do whatever u need to do here



                        }          
                });  


                layout.addView(renderView, renderViewparams);

                layout.addView(vView, params);
                super.setContentView(layout);
                this.mRenderSurfaceView = renderView;
                this.mRenderSurfaceView.setEGLConfigChooser(false);
                this.mRenderSurfaceView.setRenderer(this.mEngine, this);
        }
4

0 回答 0