I am working on video player application, I want to play .mp4 video in native videoview. I am not able to play video using url. I am getting error Sorry this video cannot be played and also I am not able to play downloaded video in native videoview.
My code for playing video in videoview:
String mUrl = "http://www.servername.com/projects/projectname/videos/1361439400.mp4";
VideoView mVideoView = (VideoView)findViewById(R.id.videoview)
videoMediaController = new MediaController(this);
mVideoView.setVideoPath(mUrl);
videoMediaController.setMediaPlayer(mVideoView);
mVideoView.setMediaController(videoMediaController);
mVideoView.requestFocus();
mVideoView.start();
Kindly share your ideas for the same.
Thanks.
MP4 is just a container - the video and audio stream inside it will both be encoded in different formats.
Android natively only supports certain types of formats. This is the list here.
Make sure the video and audio encoding type is supported. Just because it says "mp4" doesn't automatically mean it should be playable.
Finally it works for me.
Hope this would help others.
Check the format of the video you are rendering. Rendering of mp4 format started from API level 11 and the format must be mp4(H.264)
I encountered the same problem, I had to convert my video to many formats before I hit the format: Use total video converter to convert the video to mp4. It works like a charm.
I'm not sure that is the problem but what worked for me is calling
mVideoView.start();
inside themVideoView.setOnPreparedListener
event callback.For example:
Use Like this:
Another Method:
If you are getting this error Couldn't open file on client side, trying server side Error in Android. and also Refer this. Hope this will give you some solution.