title: MediaPlayer RTSP video stream with authentication
body: <p>I was able to stream a video from ip camera without authorization, but now i need to do this with authorization. I found few information that says that Android doesn't support authentication by RTSP, but I found another information that says that it is possible in API level 14 by adding HEADERS with that method: <a href="http://developer.android.com/reference/android/media/MediaPlayer.html#setDataSource%28android.content.Context,%20android.net.Uri,%20java.util.Map%3Cjava.lang.String,%20java.lang.String%3E%29" rel="nofollow">setDataSource (Context context, Uri uri, Map headers)</a>. My code looks like this:</p>
  
  <pre><code>@Override
  public void surfaceCreated(SurfaceHolder holder){
      String authHeader = getB64Auth("user","password");
      Map&lt;String, String&gt; headers = new HashMap&lt;String, String&gt;();
      headers.put("Authorization", authHeader);
      Uri srcUri = Uri.parse("rtsp://10.0.0.113:554/channel1");
          try{
              m.setDisplay(h);
              m.setDataSource (getApplicationContext(), srcUri,headers);
              m.prepare();
              m.setAudioStreamType(AudioManager.STREAM_MUSIC);
              m.start();
          }catch(Exception e){
              e.printStackTrace();
          }
  
  }
  @Override
  public void surfaceDestroyed(SurfaceHolder holder) {
      m.release();
  }
  private String getB64Auth (String login, String pass) {
      String source=login+":"+pass;
      String ret="Basic "+Base64.encodeToString(source.getBytes(),Base64.URL_SAFE|Base64.NO_WRAP);
      Log.e("Authorization",ret);
      return ret;
  }
  </code></pre>
  
  <p>But it doesn't work and i can't find where is the problem. Does anybody have any experience with that kind of streaming? Or maybe I just misunderstood the effect of the new method of MediaPlayer class?</p>