title: Android: Video is playable from gallery but when I play it using Intent.ACTION_VIEW type video, cannot play
body: <p><a href="https://stackoverflow.com/questions/14133140/intent-action-view-video-external-storage-video-sorry-this-video-cannot-be-pl/">Here is my original question</a></p>
  
  <p>I've implemented the answer there but still the problem persist.</p>
  
  <p>Here is the gist:
  So I'm playing a video from external storage(sdcard), I'm having a problem with playing the video and this is my code:</p>
  
  <pre><code>Uri uri = Uri.parse(url);
  intent = new Intent(Intent.ACTION_VIEW);
  intent.setDataAndType(uri, "video/*");
  </code></pre>
  
  <p>It prompts "Sorry, this video cannot be played", but in the gallery, it is playable. I printed the url and this is what I got:</p>
  
  <pre><code>VideoPlayer url: file:///mnt/sdcard/foldername/video-2012-12-26-21-26--44.mp4
  </code></pre>
  
  <p>The file exist from the answer that I got. But still the problem persist, and I have no idea what went wrong.</p>
  
  <p>Any insight is appreciated. Thanks</p>
  
  <p>Edit:To those who didn't see the answer in the first question. I've already implemented this:</p>
  
  <pre><code>intent = new Intent(Intent.ACTION_VIEW);
  
  File sdCard = Environment.getExternalStorageDirectory();
  File file = new File(sdCard, "/foldername/video-2012-12-26-21-26--44.mp4");
  
  intent.setDataAndType(Uri.fromFile(file), "video/*");
  
  startActivity(intent);
  </code></pre>
  
  <p>The file exist since I've checked it. I'm wondering if there is a problem with the file naming convention.</p>
  
  <p>Also I'm debugging from my device, Samsung Galaxy Ace, Android 2.3.6, compiling with 4.2 sdk.</p>
  
  <p>Edit 2:
  I've tried renaming the video into simpler one and now the video works, my guess is that the the file has a filename length limitation or an naming convention.</p>