VideoView回调中的表面无效

时间:2011-08-02 17:21:02

标签: android surfaceview android-videoview

我有一个TabbedActivity,它有2个标签。每个选项卡都有自己的活动,活动会进行视频播放。我想在这些活动中访问VideoViews的底层表面,因此我实现了SurfaceHolder.Callback,如下所示:

public void surfaceChanged(SurfaceHolder holder, int format, int width,
        int height) {
    // TODO Auto-generated method stub
    Log.e(TAG,"surfaceChanged "+ holder+" format "+format+" w "+width+" h "+height);
    if (holder.getSurface().isValid())
        Log.e(TAG,"holder has a valid surface");
    else
        Log.e(TAG,"holder has an invalid surface");     
}

public void surfaceCreated(SurfaceHolder holder) {
    // TODO Auto-generated method stub
    if (holder.getSurface().isValid())
        Log.e(TAG,"holder has a valid surface");
    else
        Log.e(TAG,"holder has an invalid surface");
    mHolder = holder;

}

当我运行此代码时,回调始终显示表面所有者具有无效表面。所以,无论我在表面上做什么,mHolder.getSurface()都会进入NULL表面。我在这里缺少什么?

提前致谢

0 个答案:

没有答案