So I created a directory on the internal storage like so:
File mediadir = getDir("tvr", Context.MODE_PRIVATE);
Then I download files from a server and save them inside the directory like this:
URL url = new URL(urlString);
URLConnection conexion = url.openConnection();
conexion.connect();
int lenghtOfFile = conexion.getContentLength();
InputStream is = url.openStream();
Log.d("DOWNLOAD NAME",name);
FileOutputStream fos = new FileOutputStream(mediadir+name);
etc
Then files are saved successfully, then next I want to play them like this:
String path = filelist[playListIndex].getAbsolutePath();
videoView = (VideoView) findViewById(R.id.videoView);
videoView.setVisibility(View.VISIBLE);
videoView.setOnCompletionListener(this);
videoView.setVideoPath(path);
videoView.start();
where path is :
/data/data/com.mypackage/tvr/video.mp4
The file does not want to play with this error:
02-20 15:57:21.447: E/MediaPlayer(24143): error (1, -2147483648)
And on the device a message pops up : Cannot play video, Sorry this video cannot be player.
Is this a issue with rights or what? If it is, I was thinking because I created them, I have the rights to them?