chikadance
chikadance

Reputation: 4187

VideoView "can't play the video" error

here is my video, i can play this video on any player except VideoView(but I can play it with MediaPlayer#setDataSource), here is my code:

    VideoView vp = (VideoView) findViewById(R.id.player);
    vp.setVideoPath("/sdcard/videoRecorder/2016-05-09-10:31:42.mp4");

the monitor only provide "unknown error" like

05-09 11:22:53.173 4667-4683/ro.adr.test E/MediaPlayer: error (1, -2147483648)
05-09 11:22:53.339 4667-4667/ro.adr.test E/MediaPlayer: Error (1,-2147483648)

I hope find a way use VideoView play this video, how to do it?

Upvotes: 0

Views: 769

Answers (1)

Hammer
Hammer

Reputation: 8888

the file name looks suspicious. Could you try changing it to a standard one to test again? i.e. without ":"

You can still use setVideoPath(string path), but need to make sure the path is a uriString. Below is the actual implementation of this method in Android. You need to encode your string first before passing in.

public void setVideoPath(String path) {
    setVideoURI(Uri.parse(path));
}

uri reference: http://developer.android.com/reference/android/net/Uri.html

Upvotes: 1

Related Questions