我正在研究基于动画和视频的简单应用程序 . 我正在使用andEngine来构建游戏应用程序 . 我可以在我的应用程序中管理动画和音乐,但我不知道如何在我的应用程序中使用AndEngine播放视频 .

在AndEngine中是否有任何内置的视频类或者我应该使用另一个库,或者我只需要使用原生的Android视频?

我尝试使用Android的VideoView使用AndEngine的SimpleLayoutGameActivity . 但问题是:我想在后台播放视频,而我的渲染器应该在所有带有动画的精灵的前景中 . 因此,我的渲染器与VideoView重叠,并且不会将其背景从黑色更改为透明 .

这是我的XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.techd.andenginedemo.GameActivity">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY"
        android:src="@mipmap/background" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <VideoView
            android:id="@+id/videoBG"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:visibility="gone" />
    </RelativeLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"

        android:visibility="visible">

        <org.andengine.opengl.view.RenderSurfaceView
            android:id="@+id/xmllayoutexample_rendersurfaceview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </LinearLayout>

</RelativeLayout>

在这里,我想在用户启动应用程序时显示背景图像 . 然后,当用户点击特定的精灵背景时,图像应该消失,视频视图应该开始播放原始文件夹中的视频 . 但 RenderSurfaceView 将背景视为黑色,我的背景图像未在我的应用中显示 . 因此,它也不会显示我的视频 .

我怎样才能解决这个问题?