| 
| [°³¹ß Tip] ¿Àµð¿À - ºñµð¿À ½ÇÇà |  |  
|  |  |    | 9³â Àü |  | 
| //¿Àµð¿À ¿¬ÁÖ public void audioPlayer(String path, String fileName){
 //set up MediaPlayer
 MediaPlayer mp = new MediaPlayer();
 
 try {
 mp.setDataSource(path+"/"+fileName);
 } catch (IllegalArgumentException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 } catch (IllegalStateException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 } catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }
 try {
 mp.prepare();
 } catch (IllegalStateException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 } catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }
 mp.start();
 }
 
 //ºñµð¿À ½ÇÇà
 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();
 }
 
 }
 
 | 
 |  
|  ̵̧ : 363 | ̵̧
¸ñ·Ï |  |