글목록

2014. 5. 8.

[Android] How to play a video file from SD card


                       

  public void play() {

    
   
         if(myVideoNum == 0 )
         {       
           //Resource
           uri = "android.resource://" + getPackageName() + "/raw/toplogic" ;
           Uri video = Uri.parse(uri);
           mVideoView.setVideoURI(video);
            mVideoView.start();
        
          
         }else{
           
            //SDcard
           File clip=new File(Environment.getExternalStorageDirectory() + "/ToplogicApp/toplogic.mp4");
           
           if (clip.exists()) {
           
            mVideoView.setVideoPath(clip.getAbsolutePath());
            mVideoView.start();
           }
           else
           {
            videoError();
           }
           
         }

  
   
      
  }



댓글 없음:

댓글 쓰기