title: Android VideoView Cannot play video mp4
body: <p>I used the Android VideoView to play a video file via HTTP. My problem is my phone prompts "Cannot play video  Sorry, this video cannot be played." when playing a mp4 file from HTTP. But it is ok when playing another mp4 video file. </p>
  
  <p>When used in a newer phone, like Samsung Galaxy S, my program can play both mp4 video file from HTTP successfully.</p>
  
  <p>My phone:  </p>
  
  <pre><code>Samsung GT-S5830  
  Android version: 2.3.4  
  Display: 320x480.
  
  Video file 1 (OK):  
  Video Codec: H.264  
  Resolution: 640x360  
  Others: 16:9, 340kbps, 29.92fps  
  Audio Codec: AAC, 44kHz 96kbps Stereo.
  
  
  Video file 2 (Fail):  
  Video Codec: H.264  
  Resolution: 640x360  
  Others: 16:9, 993kbps, 25fps  
  Audio Codec: AAC 44kHz 125kbps Stereo.
  </code></pre>
  
  <p>Below is my code that hardcoded to play the video file 1 successfully.</p>
  
  <pre><code>public class VideoPlayActivity extends Activity {
  VideoView vv;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      //requestWindowFeature(Window.FEATURE_NO_TITLE);
      //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  
      vv = new VideoView(this);
      RelativeLayout.LayoutParams param1 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
      param1.addRule(RelativeLayout.CENTER_IN_PARENT);
      vv.setOnErrorListener(new OnErrorListener() {
  
          public boolean onError(MediaPlayer mp, int what, int extra) {
              Log.d("Dbg", "OnErrorListener: onError: " + what + ", " + extra);
              return false;
          }
  
      });
  
      RelativeLayout layout = new RelativeLayout(this);
      layout.addView(vv, param1);
  
      setContentView(layout);
  
      playContent();
  
   }
  
   private void playContent() {
      String path = "http://rmcdn.2mdn.net/MotifFiles/html/1248596/android_1330378998288.mp4";
  
      vv.setVideoPath(path);
      vv.requestFocus();
      vv.start();
      }
  }
  </code></pre>
  
  <p>The error log when playing video file 2 is as below:  </p>
  
  <pre><code>11-19 17:49:30.119: I/VideoView(16860): start()  
  11-19 17:49:30.139: E/MediaPlayer(16860): error (1, -2147483648)  
  11-19 17:49:30.149: E/MediaPlayer(16860): Error (1,-2147483648)  
  11-19 17:49:30.149: D/VideoView(16860): Error: 1,-2147483648  
  11-19 17:49:30.149: D/Dbg(16860): OnErrorListener: onError: 1, -2147483648  
  </code></pre>
  
  <p>It is noted that I tried to install the MX player and downloaded the both video file into my phone's SD card. The MX player can play both video files successfully.</p>
  
  <p>So, can anyone help me to answer the questions below:  </p>
  
  <ol>
  <li>Why my program cannot play the video file 2 on my phone?  </li>
  <li>How can I play the video file 2 on my phone?</li>
  </ol>
  
  <p>Thank you for your advice.</p>