Reputation: 64864
I want to play video file from android cache folder using the following code :
String cacheDir = getApplicationContext().getCacheDir().getAbsolutePath();
File outFile = new File(cacheDir, "intro.mp4");
vvIntro.setVideoPath(cacheDir+"/intro");
vvIntro.start();
But I got error :
07-05 20:14:21.896: E/MediaPlayer(1251): error (1, -2147483648)
07-05 20:14:21.928: I/Choreographer(1251): Skipped 79 frames! The application may be doing too much work on its main thread.
07-05 20:14:22.186: D/gralloc_goldfish(1251): Emulator without GPU emulation detected.
07-05 20:14:22.496: E/MediaPlayer(1251): Error (1,-2147483648)
07-05 20:14:22.496: D/VideoView(1251): Error: 1,-2147483648
where the file is already exists and the required persimmon as show below :
Upvotes: 2
Views: 8130
Reputation: 97
you can set Uri :
Uri uri = Uri.parse(getApplicationContext().getCacheDir()+"/video.mp4") ;
videoView.setVideoURI(uri);
videoView.start();
Upvotes: 0
Reputation: 856
You can just use my simple library AndroidVideoCache. It allows stream and cache video simultaneously.
Upvotes: 1
Reputation: 1006964
You create a File
object pointing to your MP4 file, then totally ignore that File
object and provide an invalid path to vvIntro
. Instead, try:
File outFile = new File(getCacheDir(), "yourVideoName.mp4");
vvIntro.setVideoPath(outFile.getAbsolutePath());
vvIntro.start();
and see if that helps.
Upvotes: 3