Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Video extends Activity {
- private MediaController mc;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- videoPlayer("mnt/sdcard","bikekid",true);
- }
- public void videoPlayer(String path, String fileName, boolean autoplay){
- //get current window information, and set format, set it up differently, if you need some special effects
- getWindow().setFormat(PixelFormat.TRANSLUCENT);
- //the VideoView will hold the video
- VideoView videoHolder = new VideoView(this);
- //MediaController is the ui control howering above the video (just like in the default youtube player).
- videoHolder.setMediaController(new MediaController(this));
- //assing a video file to the video holder
- videoHolder.setVideoURI(Uri.parse(path+"/"+fileName));
- //get focus, before playing the video.
- videoHolder.requestFocus();
- if(autoplay){
- videoHolder.start();
- }
- }
- }/// end class
- .getAbsolutePath()
- File file = new File(Environment.getExternalStorageDirectory(),"bikekid");
- Uri mUri = Uri.fromFile(fie);
- videoHolder.setVideoURI(mUri);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement