放播视频

 
  
 
  
 
  
xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <VideoView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/vv_video"
        />
LinearLayout>
import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.widget.MediaController; import android.widget.VideoView; /** * Created by Administrator on 2017/7/21 0021. */ public class Video extends AppCompatActivity { private VideoView vv_video; @Override protected void onCreate( @Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout. video); vv_video = (VideoView) findViewById(R.id. vv_video); vv_video.setVideoURI(Uri. parse( "file://mnt/sdcard/dcim/camera/VID_20170426_140439.mp4")); MediaController mediaController= new MediaController( this); mediaController.setMediaPlayer( vv_video); vv_video.setMediaController(mediaController); }}
 
 

你可能感兴趣的:(放播视频)