Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Video Capture Sample App

Is there a stand-alone sample code for video capturing in Android ?

like image 613
Jason Avatar asked Mar 31 '10 05:03

Jason


2 Answers

Here is what I provide to my students: Camcorder Source

like image 160
vanevery Avatar answered Oct 02 '22 20:10

vanevery


Not sure why I didn't think of this sooner. If you're just looking to capture a video so you can take that video and upload it to a server (or do something similar) you can use the native camera app extremely easily using intents.

Launch the intent, capture the video, then return to your activity, and access the video via onActivityResult.

// Setup a result flag for your video capture
int ACTION_TAKE_VIDEO = 100;

// Launch an intent to capture video from MediaStore
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(takeVideoIntent, ACTION_TAKE_VIDEO);

// Obtain the file path to the video in onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent data) {

if (resultCode == RESULT_OK) {

    if (requestCode == ACTION_TAKE_VIDEO) {

        Uri videoUri = data.getData();
        String filePath = getPath(videoUri);
        Log.d("LOGCAT", "Video path is: " + filePath);
    }
}

More at http://developer.android.com/training/camera/videobasics.html

like image 30
Kyle Clegg Avatar answered Oct 02 '22 19:10

Kyle Clegg