javaandroidvideovideo-codecs

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


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();

Solution

  • 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...