用videoview播放3gp文件,总提示 sorry,this video cannot be played.
用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>