SHARE
TWEET

Untitled

a guest Feb 19th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Video extends Activity {
  2. private MediaController mc;
  3. @Override
  4. public void onCreate(Bundle savedInstanceState) {
  5.     super.onCreate(savedInstanceState);
  6.  
  7.     videoPlayer("mnt/sdcard","bikekid",true);
  8. }
  9.  
  10.  
  11. public void videoPlayer(String path, String fileName, boolean autoplay){
  12.     //get current window information, and set format, set it up differently, if you need some special effects
  13.     getWindow().setFormat(PixelFormat.TRANSLUCENT);
  14.     //the VideoView will hold the video
  15.     VideoView videoHolder = new VideoView(this);
  16.     //MediaController is the ui control howering above the video (just like in the default youtube player).
  17.     videoHolder.setMediaController(new MediaController(this));
  18.     //assing a video file to the video holder
  19.     videoHolder.setVideoURI(Uri.parse(path+"/"+fileName));
  20.     //get focus, before playing the video.
  21.     videoHolder.requestFocus();
  22.     if(autoplay){
  23.         videoHolder.start();
  24.     }
  25.  
  26.  }
  27.  
  28. }/// end class
  29.    
  30. .getAbsolutePath()
  31.    
  32. File file = new File(Environment.getExternalStorageDirectory(),"bikekid");
  33. Uri mUri = Uri.fromFile(fie);
  34. videoHolder.setVideoURI(mUri);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top