Android videoview error 1, -2147483648

I get an error when playing a video from a resource folder and a source folder.
Error MediaPlayer (1, -2147483648) Error VideoView 1, -2147483648.

I tried from a folder with resources like.

private String SrcPath = "file:///android_asset/aaa.mp4"; //also tried aaaa.mp3
VideoView vv = (VideoView)findViewById(R.id.videoView1);
vv.setVideoPath(SrcPath);
MediaController controller = new MediaController(this);
controller.setAnchorView(vv);
vv.setMediaController(controller);
vv.requestFocus();
vv.start();

and for the raw folder, I used the URI as:

Uri video = Uri.parse("android.resource://com.usecontentprovider/raw/aaa.mp4");
vv.setVideoURI(video);

In both cases, I received one error message.

+3
source share
3 answers

I found a solution because I can play videos on a virtual device.

I replaced the string

Uri video = Uri.parse("android.resource://com.usecontentprovider/raw/aaa.mp4");

with

Uri video = Uri.parse("android.resource://com.usecontentprovider/raw/"+R.raw.aaa);

And its working

+1
source

, avinaptic2, , android.

, . H.264 3 Android.

+1

R.raw , . , : videoView.start() onPrepare().

: Android: " " ; MediaPlayer VideoView 1 -38

0
source

All Articles