【发布时间】:2016-09-30 00:43:05
【问题描述】:
我正在尝试显示原始文件夹中的 mp4 视频。当应用程序打开时,视频应该会自动在 videoview 中播放。我希望视频在活动启动后立即开始(这是启动器活动)。我还希望视频循环播放并且没有声音。我的 xml 在下面。
<VideoView
android:id="@+id/launcherVideo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/linearLayout" />
这是我的代码。
String fileName = "android.resource://"+ getPackageName()+"/raw/launchervideo";
VideoView mvideo = (VideoView) findViewById(R.id.launcherVideo);
mvideo.setVideoPath(Launcher);
MediaController controller = new MediaController(this);
mvideo.setMediaController(controller);
mvideo.requestFocus();
mvideo.start();
}
当我运行应用程序时,这段代码目前除了显示一个空白屏幕之外什么也没做,我不知道为什么。有人可以帮忙吗?
【问题讨论】: