package com.example.admin.myapplication; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.MediaController; import android.widget.VideoView; public class MainActivity extends AppCompatActivity { private VideoView video; MediaController mediaController; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); video= (VideoView) findViewById(R.id.videoView); mediaController = new MediaController(this); String path= Environment.getExternalStorageDirectory().getAbsolutePath() +"/Free Loop"; video.setVideoPath(path); video.setMediaController(mediaController); mediaController.setMediaPlayer(video); } }
相关分类