title: Black screen while trying to stream IP camera in android
body: <p>I’m developping an android app to monitor some IP cameras.
  I’m using the <a href="http://code.google.com/p/android-camera-axis/source/browse/trunk/serealisation/src/de/mjpegsample/MjpegView/?r=33" rel="nofollow">MjpegView Class</a> to stream the video.</p>
  
  <p>I’ve three cameras.</p>
  
  <ul> - Camera 1: A public camera i found  on internet, without user/password.</ul>
  
  <ul> - Camera 2: A public camera but this one require username/password.</ul>
  
  <ul> - Camera 3: The camera I’m going to use finally in my app. It will also ask for credentials.</ul>
  
  <p>The code in my main activity is the following:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class MainActivity extends Activity {
      private MjpegView mv;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          //Camera 1
          String URL = "http://216.62.222.101/mjpg/video.mjpg";
  
          //Camera 2
          // String URL = "http://user:user@iprobocam.marmitek.com/cgi/mjpg/mjpg.cgi";
  
          //Camera 3
          // String URL = "http://MyIp:MyPort/mjpg/video.mjpg";
  
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
          mv = new MjpegView(this);
          setContentView(mv);
          mv.setSource(MjpegInputStream.read(URL));
          mv.setDisplayMode(MjpegView.SIZE_BEST_FIT);
          mv.showFps(true);
      }
  
      public void onPause() {
          super.onPause();
          mv.stopPlayback();
  }
  </code></pre>
  
  <p>I can stream the camera 1 without problems. When I run the app with the cameras 2 or 3 there are no errors neither warnings but the most I get is a black screen. I thougth it was a problem with the authentification but if I remove it from my camera I get the same result, the black screen.</p>
  
  <p>What is the difference between the cameras that makes some of them work but not others?</p>
  
  <p>Thanks in advance for any help.</p>
  
  <p>--- EDIT ---</p>
  
  <p>I've found something weird while running the app with the camera 2.
  I catch an exception in <code>MjpegView</code> class when it calls the method <code>MjpegInputStream.readMjpegFrame</code>.
  Looking deeper I notice that the method <code>getEndOfSeqeunce</code> always return 1 while Camera 1 (the one which works well) return higher values (between 66 and 68).</p>
  
  <p>I hope this can give someone an idea of what is happening here...</p>