VideoView vs MediaPlayer?
android, android-mediaplayer, android-video-player
Solution
The basic reason is the MODE_PRIVATE, which disallow VideoView and MediaPlayer from playing non-World Readable files, unless you pass the FD as you have.
Here's a more detailed explanation
Problem
Please tell me why this would work on with MediaPLayer and not in videoView? And how to make it work with a video view? Videos are downloaded form an API and saved in this folder I created: ``` File mediadir = cw.getDir("tvr", Context.MODE_PRIVATE); ``` VideoView ``` final Uri uri = Uri.parse(path); // path = /data/data/com.foo.app/tvr/video.mp4 videoView = (VideoView) findViewById(R.id.videoView); videoView.setVisibility(View.VISIBLE); videoView.setOnCompletionListener(this); videoView.setVideoURI(Uri.parse(path)); videoView.start(); ``` Error VideoView Sorry, this Video cannot be player and error (1, -2...) MediaPlayer --- THIS WORKS ``` FileInputStream fileInputStream = new FileInputStream(path); MediaPlayer pl = new MediaPlayer(); pl.setDataSource(fileInputStream.getFD()); pl.prepare(); pl.start(); ```