Set up the Intent to do video capture and then call StartActivityForResult.
The example has a hard-coded 2 as the identifier.

                Intent i = new Intent("android.media.action.VIDEO_CAPTURE");
                startActivityForResult(i, 2);


Add an onActivityResult Method

protected void  onActivityResult  (int requestCode, int resultCode, Intent
data){
...
 if (requestCode==2){ // Our request for video capture
                 if (resultCode == RESULT_OK) { // a good results
                     try {
                         AssetFileDescriptor videoAsset =
getContentResolver().openAssetFileDescriptor(data.getData(), "r");
                       //... do something with the AssetFileDescriptor
                      // to read the file, create an inputStream

                      FileInputStream fileInputStream
=videoAsset.createInputStream();


                     } catch (FileNotFoundException e) {

                         Toast.makeText(getBaseContext(),  "Could not find
Video file",
                                    Toast.LENGTH_LONG).show();

                     }
                 }
             }


-- 
Carmen
http://www.twitter.com/CarmenDelessio
http://www.talkingandroid.com
http://www.facebook.com/BFFPhoto
http://www.twitter.com/DroidDrop

On Sun, Apr 4, 2010 at 8:29 PM, bmalicoat <[email protected]> wrote:

> I'm trying to use the built in camera to capture a video but when I
> specify the URI I want the file saved to (using
> videoCaptureIntent.putExtra (MediaStore.EXTRA_OUTPUT, Uri.fromFile
> (fileLocation)); ) the 'Retake' and 'Play' buttons crash my app. I am
> trying to switch and let the Intent store the file where it wants but
> I can't figure out how to recover the URI where it is saved to. The
> docs say this:
>
> "The caller may pass in an extra EXTRA_OUTPUT to control where the
> video is written. If EXTRA_OUTPUT is not present the video will be
> written to the standard location for videos, and the Uri of that
> location will be returned in the data field of the Uri."
>
>
> But what is "the data field of the Uri"?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to