My code below to streaming video:
VideoView vv = (VideoView)this.findViewById(R.id.screen_video);
Uri uri = Uri.parse(URL);
vv.setVideoURI(uri);
vv.start();
It works. But if the URL video's format not support by android phone or pad. It show a dialog, and not show the screen. But it still streaming with black screen. I want to get the error message, and access as an exception. But I don't know how to get it?
Another problem is that the streaming may crash cause by low speed wifi. How to check it to wait while low speed wifi?
You shouldn't play the video instantly. Add OnPrepared listener to the video view and start the video playing after it. With MediaPlayer you could keep track of the buffering state and stop the video for a while when its not yet downloaded. Please have a look at this guide.
It depends on which Android Version you are developing your application on. There are certain devices which do not support running .mp4 file. Go through Android Media support for more information. Check if you can play any .3gp files or not.
Try Intent to avoid that error. or put try catch in your block. VideoView can only Stream 3gp videos but i recommend this code to stream your video
Or Click here to watch Android Video Streaming Tutorial.
try this code,it work,