如何通过andengine在游戏中无缝播放视频?

时间:2012-07-23 05:09:31

标签: android andengine

我正在尝试在游戏关卡结束时播放视频,因为我正在使用视频,但是当我播放该视频时,黑色屏幕出现几毫秒。请提出解决此问题的方法。还有其他方法可以播放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);
        }

0 个答案:

没有答案