Buddy, you should see the answer to the next Question, It works for me and definitely works for you.
Android: video gives an error
NOTE. I have the following error:
in com.sec.android.app.camera.CamcorderEngine.renameTempFile (CamcorderEngine.java:1206)
Solution: Work in Android 2.2, 2.3 ... I did the following process to capture photos
int CAMERA_WITH_VIDEO_DATA = 2; //start photo capture activity... Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE, null); startActivityForResult(intent, CAMERA_WITH_VIDEO_DATA); .... .... private void saveVideoFileOnActivityResult(Intent videoIntent){ FileInputStream fis = null; FileOutputStream fos = null; File mCurrentVideoFile = null; try { mCurrentVideoFile = new File("path_to_your_file"); AssetFileDescriptor videoAsset = getContentResolver().openAssetFileDescriptor(videoIntent.getData(), "r"); fis = videoAsset.createInputStream(); //File videoFile = new File(Environment.getExternalStorageDirectory(),"<VideoFileName>.mp4"); fos = new FileOutputStream(mCurrentVideoFile); byte[] buffer = new byte[1024]; int length; while ((length = fis.read(buffer)) > 0) { fos.write(buffer, 0, length); } //fis.close(); //fos.close(); } catch (IOException e) { // TODO: handle error e.printStackTrace(); }finally{ try { if(fis!=null) fis.close(); if(fos!=null) fos.close(); } catch (Exception e2) { // TODO: handle exception e2.printStackTrace(); } } } .... .... protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case CAMERA_WITH_VIDEO_DATA: //pass data to above method to save it. saveVideoFileOnActivityResult(data); break; default: break; } }
source share