Android Video Capture Sample App

女生的网名这么多〃 提交于 2019-12-20 10:28:41

问题


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


回答1:


Here is what I provide to my students: Camcorder Source




回答2:


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




回答3:


I found a good solution from here




回答4:


I am not aware of a stand-alone code sample, but in the Android camera documentation, in the Class overview, there is a very nice step by step procedure that shows you how to record video.

I think is nearly as well as a sample code.



来源:https://stackoverflow.com/questions/2550743/android-video-capture-sample-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!