title: MediaPlayer: error (1, -38) Have error in Android
body: <p>I tried using the default mediaPlayer for playing videos by URL. But I have the following error:</p>
  
  <blockquote>
    <p><strong>MediaPlayer: error (1, -38)</strong></p>
  </blockquote>
  
  <p>I can understand why I have this. I think it in my code problem or in some logic. You can see My code bellow:</p>
  
  <pre><code>private VideoView videoView;
      private int position = 0;
      private MediaController mediaController;
      private static final String TEST_URL = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_player);
          videoView = (VideoView) findViewById(R.id.videoView);
  
          // Set the media controller buttons
          if (mediaController == null) {
              mediaController = new MediaController(this);
  
              // Set the videoView that acts as the anchor for the MediaController.
              mediaController.setAnchorView(videoView);
  
  
              // Set MediaController for VideoView
              videoView.setMediaController(mediaController);
          }
  
  
          try {
              // ID of video file.
              videoView.setVideoURI(Uri.parse(TEST_URL));
          } catch (Exception e) {
              Log.e("Error", e.getMessage());
          }
  
          videoView.requestFocus();
  
  
          // When the video file ready for playback.
          videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
  
              public void onPrepared(MediaPlayer mediaPlayer) {
  
  
                  videoView.seekTo(position);
                  if (position == 0) {
                      videoView.start();
                  }
  
                  // When video Screen change size.
                  mediaPlayer.setOnVideoSizeChangedListener(new MediaPlayer.OnVideoSizeChangedListener() {
                      @Override
                      public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
  
                          // Re-Set the videoView that acts as the anchor for the MediaController
                          mediaController.setAnchorView(videoView);
                      }
                  });
              }
          });
  
      }
  
      // Find ID corresponding to the name of the resource (in the directory raw).
      public int getRawResIdByName(String resName) {
          String pkgName = this.getPackageName();
          // Return 0 if not found.
          int resID = this.getResources().getIdentifier(resName, "raw", pkgName);
          Log.i("AndroidVideoView", "Res Name: " + resName + "==&gt; Res ID = " + resID);
          return resID;
      }
  
  
      // When you change direction of phone, this method will be called.
      // It store the state of video (Current position)
      @Override
      public void onSaveInstanceState(Bundle savedInstanceState) {
          super.onSaveInstanceState(savedInstanceState);
  
          // Store current position.
          savedInstanceState.putInt("CurrentPosition", videoView.getCurrentPosition());
          videoView.pause();
      }
  
  
      // After rotating the phone. This method is called.
      @Override
      public void onRestoreInstanceState(Bundle savedInstanceState) {
          super.onRestoreInstanceState(savedInstanceState);
  
          // Get saved position.
          position = savedInstanceState.getInt("CurrentPosition");
          videoView.seekTo(position);
      }
  </code></pre>
  
  <p><strong>MediaPlayer: error (1, -38)</strong> maybe this problem for some codecs but my device not want play this video</p>