0

i saved the video in this way, on my internal storage :

mMediaRecorder.setOutputFile(getOutputMediaFile(MEDIA_TYPE_VIDEO)
                .toString());
        outputFileName = getOutputMediaFile(MEDIA_TYPE_VIDEO).toString();


private File getOutputMediaFile(int type) {

mediaStorageDir = new File(getFilesDir().getAbsolutePath(),"YV" ); } 

if (type == MEDIA_TYPE_VIDEO) {
            mediaFile = new File(mediaStorageDir.getPath() + File.separator
                    + "YV" + timeStamp + ".mp4");   

the probleb begin whan i try to play the video like this :

MediaController mc = new MediaController (this); 
                videoView.setMediaController(mc);
                videoView.setVideoPath(outputFileName);
                videoView.start();

i receive msg that video can not open, i think this because world-readable permissions.

How to change the file permissions? , am I need to change anything in this line also ?

videoView.setVideoPath(outputFileName);
idan
  • 1,508
  • 5
  • 29
  • 60

1 Answers1

0

add this permission for read and write in manifest file

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Sunil Kumar
  • 7,086
  • 4
  • 32
  • 50
  • what you suggest is for external storage but i need save in the internal storage. i think this someting like FileInputStream fileInputStream = new FileInputStream("/data/data/com.mypackage/myfile"); mediaPlayer.setDataSource(fileInputStream.getFD()); – idan Jun 01 '13 at 16:17