用videoview播放3gp文件,总提示 sorry,this video cannot be played.代码
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView myVideoView = (VideoView)findViewById(R.id.videoView1);
Uri mUri = Uri.parse("android.resource://com.TestProject/"+R.raw.video2);
myVideoView.setVideoURI(mUri);
myVideoView.setMediaController(new MediaController(this));
myVideoView.requestFocus();
myVideoView.start();
}
main.xml<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/videoView1" android:layout_width="wrap_content" android:layout_height="wrap_content"></VideoView>
</LinearLayout>
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView myVideoView = (VideoView)findViewById(R.id.videoView1);
Uri mUri = Uri.parse("android.resource://com.TestProject/"+R.raw.video2);
myVideoView.setVideoURI(mUri);
myVideoView.setMediaController(new MediaController(this));
myVideoView.requestFocus();
myVideoView.start();
}
main.xml<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/videoView1" android:layout_width="wrap_content" android:layout_height="wrap_content"></VideoView>
</LinearLayout>
解决方案 »
- android软件开发 软件换肤的一些问题
- 我运行模拟器,每隔一段时间总弹出错误提示框怎么解决
- 同一个名字的两个函数返回不同类型的数据
- 关于应用中使用照相机的问题,如下效果是如何实现的
- inflate() android sdk中调用该方法调试时报Source not found问题
- 导航条
- 编译android 4.0源码 dalvik_system_Zygote.o错误
- 求救
- android 和red5播放实时视频~或者做过android海康sdk的 求帮助
- android 二维数组 空指针异常
- android video player 滑屏切换
- 为什么我一往Drawable文件夹放入JPG图片,工程名称上就有个橙色的感叹号?
需要进入模拟器查看push的文件大小