Can't play this video. Android videoView mp4 recorded by android device

Jacob picture Jacob · Jul 14, 2014 · Viewed 50.2k times · Source

enter image description here

I've looked for existing potential solutions with other formats and those still responds with mentioned error.

Finally, recorded the video with the same device and used it as a resource for this app and it still doesn't work.

Devices: SGS2, lenovo a820

Video type: MPEG-4 video (video/mp4)

    videoView = (VideoView)findViewById(R.id.videoView);
    videoView.setVideoPath("android.resource://raw/sample.mp4");
    videoView.start();

Answer

Jayesh Khasatiya picture Jayesh Khasatiya · Jul 14, 2014

Please refer below code snippet...problem was with the path declaration..

 String uriPath = "android.resource://"+getPackageName()+"/"+R.raw.aha_hands_only_cpr_english;
        Uri uri = Uri.parse(uriPath);
        mVideoView.setVideoURI(uri);

Thats it...