视频播放器你可以在上面的一篇博客中继续写只需要把那个sd卡的那个路径改成这样的:
mediaPlayer.setDataSource(this, Uri.parse("file://mnt/sdcard/1/sister.mp4"));要用这个来显示视频图像的
<SurfaceView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/sv_main01" />在java代码中写:
//将媒体播放器展示到SurfaceView mediaPlayer.setDisplay(sv_main01.getHolder());布局
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_play" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <VideoView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/vv_main01" /></LinearLayout>Java代码:
//设置视频的来源 vv_main01.setVideoPath("file://mnt/sdcard/1/advideo.mp4"); //实例化媒体控制器 MediaController mediaController=new MediaController( this); //互相设置 mediaController.setMediaPlayer(vv_main01); vv_main01.setMediaController(mediaController);新闻热点
疑难解答