title: Android VideoView Can't play video error especially .mp4
body: <p>I'm trying to play video in my application and I get <strong>Can't play this video</strong> error. I came across lot of threads regarding this. They have asked to start video once the player is prepared. I'm doing the same. But couldn't figure out the problem. Please find my code below. </p>
  
  <pre><code>public class Video extends Activity implements MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener {
  
  public VideoView vidPlayer;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
  
      setup();
      activateVideoPlayer();
  }
  
  public void setup() {
      setContentView(R.layout.step_video);        
      vidPlayer = (VideoView) findViewById(R.id.videoPlayer);
      String playableUrl = "http://teststreaming7v.s3.amazonaws.com/public/7515/1374782317346-beagle_puppy_howl_640x360_448_main.mp4";
  
  }
  
  @Override
  public void onPrepared(final MediaPlayer mediaPlayer) {
      mediaPlayer.setLooping(false);
      mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
          startPlayer();
      videoLoaded = true;
      mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() {
          // show updated information about the buffering progress
          public void onBufferingUpdate(MediaPlayer mp, int percent) {
              Log.d(this.getClass().getName(), "percent: " + percent);
  
          }
      });
  
      mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
  
          public void onCompletion(MediaPlayer mediaPlayer) {
              progress.setProgress(100);
                      setResult(Activity.RESULT_OK);
                      finish();
          }
      });
  
      readyToPlay = true;
  }
  
  @Override
  public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);
  }
  
  @Override
  public void onPause() {
      super.onPause();
      pausePlayer();
  }
  
  @Override
  public void finish() {
      super.finish();
      overridePendingTransition(R.anim.engagement_fade_in, R.anim.engagement_fade_out);
  }
  
  @Override
  public void onBackPressed() {
      isGoingBack = true;
      setResult(Activity.RESULT_CANCELED);
      finish();
  }
  
  @Override
  public boolean onError(MediaPlayer mediaPlayer, int i, int i1) {
      JLogger.getInstance(this).log("Video Player Error!!" + Integer.toString(i) + " / " + Integer.toString(i1));
  
      return false;
  }
  
  public void startPlayer() {
      isPaused = false;
      vidPlayer.start();
  }
  
  public void pausePlayer() {
      isPaused = true;
          vidPlayer.pause();
  }
  
  private void activateVideoPlayer() {
      vidPlayer.setOnErrorListener(this);
      vidPlayer.setOnPreparedListener(this);
  
      btnPlay.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              if (vidPlayer.isPlaying()) {
                  pausePlayer();
              } else {
                  startPlayer();
              }
          }
      });
  
      vidPlayer.setVideoURI(Uri.parse(playableUrl));
      vidPlayer.seekTo(step.resumePosition);
  }
  }
  </code></pre>
  
  <p>Device that I'm using is Motorola Atrix - Android 4.1.2 - Unlocked.
  I also tried in other devices like Nexus 4, 5 and Samasung Tab 2. Its working fine there.</p>
  
  <p>This is my log :</p>
  
  <pre><code>12-16 13:42:35.184    4427-4427/? D/MediaPlayer﹕ Couldn't open file on client side,trying server side
  12-16 13:42:35.184    1417-1830/? I/AwesomePlayer﹕ setDataSource_l('http://teststreaming7v.s3.amazonaws.com/public/7515/1374782317346-beagle_puppy_howl_640x360_448_main.mp4')
  12-16 13:42:35.184    1417-5481/? V/ChromiumHTTPDataSource﹕ connect on behalf of uid 10069
  12-16 13:42:35.184    1417-5481/? I/ChromiumHTTPDataSource﹕ connect to http://teststreaming7v.s3.amazonaws.com/public/7515/1374782317346-beagle_puppy_howl_640x360_448_main.mp4 @0
  12-16 13:42:35.684    1424-1673/? I/﹕ odm_disp_esd_thread is running(467) state=1
  12-16 13:42:35.684    1417-5481/? W/WVMExtractor﹕ Failed to open libwvm.so
  12-16 13:42:36.184    4547-4576/? W/GAV2﹕ Thread[GAThread,5,main]: Exception sending hit: HttpHostConnectException
  12-16 13:42:36.184    4547-4576/? W/GAV2﹕ Thread[GAThread,5,main]: Connection to https://ssl.google-analytics.com refused
  12-16 13:42:36.184    1417-5481/? E/OMXCodec﹕ failed to allocate node OMX.Nvidia.h264.decode
  12-16 13:42:36.184    1417-5481/? E/OMXCodec﹕ failed to allocate node OMX.google.h264.decode
  12-16 13:42:36.184    1417-5481/? I/OMXCodec﹕ [OMX.google.h264.decoder] AVC profile = 77 (Main), level = 22
  12-16 13:42:36.184    1417-5481/? I/OMXCodec﹕ [OMX.google.h264.decoder] video dimensions are 320 x 240
  12-16 13:42:36.184    1417-5481/? I/OMXCodec﹕ [OMX.google.h264.decoder] Crop rect is 320 x 240 @ (0, 0)
  12-16 13:42:37.184    4427-4427/? D/MediaPlayer﹕ getMetadata
  12-16 13:42:37.184    4427-4427/? D/VideoSample﹕ onPrepared() method
  12-16 13:42:37.184    1417-1687/? D/AudioHardwareMot﹕ bufSize = 8192
  12-16 13:42:37.184    1417-5484/? E/SoftAVC﹕ Decoder failed: -2
  12-16 13:42:37.184    1417-5485/? E/OMXCodec﹕ [OMX.google.h264.decoder] ERROR(0x80001001, -1007)
  12-16 13:42:37.184    1417-5486/? I/SoftAAC2﹕ Reconfiguring decoder: 44100 Hz, 2 channels
  12-16 13:42:37.184    4427-4449/? E/MediaPlayer﹕ error (1, -2147483648)
  12-16 13:42:37.184    1692-2165/? D/dalvikvm﹕ GC_EXPLICIT freed 113K, 39% free 8906K/14467K, paused 3ms+5ms, total 93ms
  12-16 13:42:37.184    4427-4427/? E/MediaPlayer﹕ start called in state 0
  12-16 13:42:37.184    4427-4427/? E/MediaPlayer﹕ error (-38, 0)
  12-16 13:42:37.184    4427-4427/? E/MediaPlayer﹕ Error (1,-2147483648)
  12-16 13:42:37.184    4427-4427/? D/VideoView﹕ Error: 1,-2147483648
  12-16 13:42:37.184    4427-4427/? D/VideoSample﹕ VideoSample: Video Player Error!!1 / -2147483648
  12-16 13:42:37.184    4427-4427/? D/VideoSample﹕ VideoSample: Get url:    http://teststreaming7v.s3.amazonaws.com/public/7515/1374782317346-beagle_puppy_howl_640x360_448_main.mp4
  12-16 13:42:37.184    4427-4427/? E/MediaPlayer﹕ Error (-38,0)
  12-16 13:42:37.184    4427-4427/? D/VideoView﹕ Error: -38,0
  12-16 13:42:37.184    4427-4427/? D/VideoSample﹕ VideoSample: Video Player Error!!-38 / 0
  12-16 13:42:37.184    4427-4427/? D/VideoSample﹕ VideoSample: Get url: http://teststreaming7v.s3.amazonaws.com/public/7515/1374782317346-beagle_puppy_howl_640x360_448_main.mp4`
  </code></pre>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>I tried playing the following two .mp4 files out of which first one plays and second doesn't.   </p>
  
  <p><strong>Video 1 Properties</strong><br>
  <em>URL : <a href="http://www.ooklnet.com/files/368/368007/video.mp4" rel="nofollow noreferrer">Video URL</a></em><br>
  <em>Video Bit rate    : 179.9 kbits/sec</em><br>
  <em>Audio channels    : Stereo</em>  </p>
  
  <p><img src="https://i.stack.imgur.com/mHwno.png" alt="Video1"> </p>
  
  <p><strong>Video 2 Properties</strong>
  <em>URL : <a href="http://teststreaming7v.s3.amazonaws.com/public/7515/1374782317346-beagle_puppy_howl_640x360_448_main.mp4" rel="nofollow noreferrer">Video URL</a></em><br>
  <em>Video Bit rate    : 446.9 kbits/sec</em><br>
  <em>Audio channels    : Mono</em>  </p>
  
  <p><img src="https://i.stack.imgur.com/k8b9o.png" alt="Video2"></p>