Can't play this video. Android videoView mp4 r

2019-03-24 15:56发布

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

7条回答
别忘想泡老子
2楼-- · 2019-03-24 16:34

Try this following code it works..........

VideoView videoView=(VideoView)findViewById(R.id.videoView);

videoView.setVideoPath("android.resource://"+getPackageName()+"/"+R.raw.videoname;

videoView.start();
查看更多
登录 后发表回答