androidandroid-video-playervideo-recording

App was not working in some mobile devices


I developed an application. My application includes video recording and playing.

I have to play video what I have recorded from mobile. This is working in most of devices(Samsung galaxy ace,Motorola Droid x, etc.,) and not working in some of devices(Droid x2,Nexus,etc.,).

I used below code for video playing

String temp_path=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)+"/MySaveCellData/dbz_115.3gp";
    //Toast.makeText(this,getSaveCellPath(),Toast.LENGTH_LONG).show();
    if(temp_path!=null) {
            //int width = myView.getMeasuredWidth();
          //  int height = myView.getMeasuredHeight();
            //we add 10 pixels to the current size of the video view every time you touch     
            //the media controller.
        Display display = getWindowManager().getDefaultDisplay(); 
        int width = display.getWidth();
        int height = display.getHeight();
        MediaController mediaController = new MediaController(this);
        mediaController.setAnchorView(myView);
        myView.setMediaController(mediaController);
       
        myView.setKeepScreenOn(true);

        //myView.setVideoAspect(width,height);
        //myView.setVideo
        myView.setVideoPath(temp_path);
        myView.start();
        myView.requestFocus();
    }
    else 
        Toast.makeText(this,"Video Path Not Found, or is set to null",Toast.LENGTH_LONG).show();        
}

What is the problem and solution?


Solution

  • The problem is not in video playing. The problem in video recording. When I record the video the hardware of device is not supporting to my code. So I changed the code of video recorder. It is working well in all devices.