Android video player can't open file on some devices

627 views Asked by At

I'm seeing an issue with playing video file from Acer a500 running on android 4.0.3.

My application is saving mp4 file to internal storage under /data/data/com.myapp.app/videos/ then at some point it has to play the file and once I do:

   ContextWrapper cw = new ContextWrapper(getApplicationContext());
        File directory = cw.getDir("videos", Context.MODE_PRIVATE);
        File savedFile = new File(directory, videoFileName);

        if (savedFile.exists()) {

            Uri uri = Uri.parse(String.valueOf(savedFile.toURI()));
            myVideoView.setVideoURI(uri); 

It results with dialog on the screen that says "Sorry, this video cannot be played".

The log files are showing the following:

06-10 17:18:37.666      85-1331/? D/AwesomePlayer﹕ Failed to open file, all profile flags have to set through setprop method.
06-10 17:18:37.666      85-1331/? I/AwesomePlayer﹕ setDataSource_l('/data/data/com.myapp.app/videos/short.mp4')
06-10 17:18:37.676    1394-1457/? E/MediaPlayer﹕ error (1, -2147483648)
06-10 17:18:37.726    1394-1394/? E/MediaPlayer﹕ Error (1,-2147483648)

When I save my videoFile it is setting Context.MODE_PRIVATE not sure if that matters.

I don't see any issues on most of devices playing video, however this one it is causing an error.

Any ideas on what could be missing? Also if I choose to play video from web-streaming, it works fine.

0

There are 0 answers