Android Intent MediaStore.ACTION_VIDEO_CAPTURE with EXTRA_OUTPUT crashes on play, retake
<p>I'm trying to make an app that records video and saves it to sdcard and when it runs again it overwrites the previous video.</p>

<p>The problem is, when I specify the Intent extra EXTRA_OUTPUT, the camera records the video to the location, but crashes on retake and play clicks.</p>

<p>The code I use is as follows:</p>

<pre><code>_path = Environment.getExternalStorageDirectory() + "/examplevideo.3gp";

File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);

Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE );
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);            
startActivityForResult(intent, 0);
</code></pre>

<p>When I stop recording, the logcat says</p>

<pre><code>VERBOSE/videocamera(6602): Setting current video filename: null
</code></pre>

<p>which is strange and seems to be a problem.</p>

<p>When I press play, I get an error, but the app keeps running(recorded video doesnt play)</p>

<pre><code>ERROR/videocamera(6602): Couldn't view video file:///mnt/sdcard/examplevideo.3gp
ERROR/videocamera(6602): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///mnt/sdcard/examplevideo.3gp }
ERROR/videocamera(6602):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
ERROR/videocamera(6602):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
ERROR/videocamera(6602):     at android.app.Activity.startActivityForResult(Activity.java:2817)
ERROR/videocamera(6602):     at android.app.Activity.startActivity(Activity.java:2923)
..
</code></pre>

<p>When I press retake, the app crashes completely with an error:</p>

<pre><code>ERROR/AndroidRuntime(6602): FATAL EXCEPTION: main
ERROR/AndroidRuntime(6602): java.lang.IllegalArgumentException: Unknown URL file:///mnt/sdcard/examplevideo.3gp
ERROR/AndroidRuntime(6602):     at android.content.ContentResolver.delete(ContentResolver.java:671)
ERROR/AndroidRuntime(6602):     at com.android.camera.VideoCamera.deleteCurrentVideo(VideoCamera.java:1010)
ERROR/AndroidRuntime(6602):     at com.android.camera.VideoCamera.discardCurrentVideoAndInitRecorder(VideoCamera.java:476)
ERROR/AndroidRuntime(6602):     at com.android.camera.VideoCamera.onClick(VideoCamera.java:420)
ERROR/AndroidRuntime(6602):     at android.view.View.performClick(View.java:2408)
...
</code></pre>

<p>The strange thing is, that this video is saved to the given location and I can play it from my sdcard, Its just that the camera activity doesnt recognize it.</p>

<p>Some help or ideas would be much appreciated!</p>
