Adnan Siddique
Adnan Siddique

Reputation: 15

How Can I record a short video in an Android app?

I am developing an application where I press a button and it will record a 10 second video and store it in internal storage. How can I do that?

Upvotes: 0

Views: 131

Answers (1)

ankor ank
ankor ank

Reputation: 302

Using Intent you can do this.

Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
if (takeVideoIntent.resolveActivity(getPackageManager()) != null) {
    startActivityForResult(takeVideoIntent, CAMERA_REQUEST_CODE_VEDIO);
}

in onActivityResult method

Uri videoUri = data.getData();
path = Utils.getRealPathFromURI(videoUri, this);
manageVideo(path); //Do whatever you want with your video

Upvotes: 3

Related Questions