7

Does anybody know the meaning of this error?

 VideoView video = (VideoView) findViewById(R.id.myvideo);    
 Intent videoint=getIntent();    
 String url =  videoint.getStringExtra("url"); //The url pointing to the mp4     
 video.setVideoPath(url);     
 video.requestFocus();     
 video.setMediaController(new MediaController(this));     
 video.start();

The manifest permissions:

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"></uses-permission>
Neil Townsend
  • 6,024
  • 5
  • 35
  • 52
trivektor
  • 5,608
  • 9
  • 37
  • 53

3 Answers3

3

I was also getting the same error on Froyo & Gingerbread. In higher Androids the same video played well. Finally after a lot of research, tried changing the Https Url to Http Url & Bingo. It resolved my issue. I was using amazon S3 server so that simply replacing the "https" in url with "http" was sufficient.

  videoUrl= videoUrl.replaceFirst("https", "http"); 

PS: For supporting older versions if you are using H.264 make sure videos are Baseline encoded.

Ajith M A
  • 3,838
  • 3
  • 32
  • 55
  • 1
    the problem was https in my case too, https is not supported before 3.1 http://developer.android.com/guide/appendix/media-formats.html – mehmet6parmak Aug 27 '13 at 21:25
  • Amazing fix! Any ideas how to make sure the video is Baseline encoded? – gtsouk Feb 05 '14 at 15:05
  • You need to cross check that with your encoding utility. In case if you are using a streaming service there might be an option(in some servers to support phones) to chose encoding profile where in you can set it baseline. – Ajith M A Feb 06 '14 at 12:53
  • worked for me too!! thanks a lot :) btw i am also using amazon s3 as a data source – nburk May 24 '14 at 07:04
3

I got the same error code. In my case the error is generated because the video encoding is not supported by android. Just try to re-encode your video.

this page should help: http://developer.android.com/guide/appendix/media-formats.html

sebataz
  • 1,025
  • 2
  • 11
  • 35
0

Have a look at this tutorial on how to use the VideoView that will shed light on your issue.

I think you have left out a line or two:

mediaController.setAnchorView(video);
video.setMediaController(new MediaController(this));
video.setVideoURI(video);

Adapt it to suit your code where applicable. The layout could be missing...

t0mm13b
  • 34,087
  • 8
  • 78
  • 110