Hemant Patel
Hemant Patel

Reputation: 3260

android videoview error 1, -2147483648

I am getting error while playing video from asset folder and raw folder.
MediaPlayer error (1, -2147483648) VideoView error 1, -2147483648.

I tried from asset folder as.

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 raw folder i used URI as :

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

I got the same error message in both cases.

Upvotes: 3

Views: 8475

Answers (3)

gabhor
gabhor

Reputation: 789

Using R.raw works fine but in some cases I still get the same error. Fortunately I found the solution to my problem: I had to call videoView.start() inside onPrepare().

You can check the correct answer here: Android: 'Can't play this video'; MediaPlayer & VideoView Error 1 -38

Upvotes: 0

Hemant Patel
Hemant Patel

Reputation: 3260

I found the solution as I am able to play video on virtual device.

I replaced the line

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

Upvotes: 1

Strigger
Strigger

Reputation: 1903

You can use software like avinaptic2 to get the video encoding information and make sure it matches the supported media formats in android.

A common problem I find is that videos are encoded with the wrong profiling. H.264 videos need to be encoded with Baseline level 3 or under to be played without errors or artifacts in Android.

Upvotes: 1

Related Questions