【发布时间】:2009-12-06 12:17:29
【问题描述】:
我正在使用 Videoview 使用 android 模拟器从本地机器播放 mp4 文件。 我听到了声音,但屏幕是空白的,看不到视频。 Android SDK 2.0.1
有谁知道这里缺少什么:
package com.hello;
import android.app.Activity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class HelloAndroid extends Activity {
VideoView vv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
vv = (VideoView) findViewById(R.id.VideoView01);
MediaController nc = new MediaController(this);
vv.setMediaController(nc);
vv.setVideoPath("/sdcard/yu.mp4");
vv.requestFocus();
vv.start();
}
public void onPause() {
vv.stopPlayback();
}
}
Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView
android:id="@+id/VideoView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></VideoView>
</LinearLayout>
【问题讨论】:
-
12-06 08:22:57.701: ERROR/SurfaceFlinger(56): layer 0x49cd70, texture=10, using format 112, GL 12-06 08:22:57.741 不支持: ERROR/SurfaceFlinger(56): layer 0x49cd70, texture=10, using format 116, which is not supported by the GL 12-06 08:22:57.791: ERROR/SurfaceFlinger(56): layer 0x49cd70, texture=10, using格式 224,GL 12-06 08:22:57.901 不支持:ERROR/SurfaceFlinger(56): layer 0x49cd70, texture=10, using format 0, GL 12-06 08:22 不支持:59.071: ERROR/SurfaceFlinger(56): GL error 0x0501 上述错误在Log中发现。
-
你能解决这个问题吗,因为我在 2.2 操作系统中也遇到了同样的问题,但我想,我在某处读到了添加 Surfaceholder 以获得显示。
标签: java android android-emulator