android videoview error 1, -2147483648

笑着哭i 提交于 2019-12-03 08:43:51

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.

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!