开发者

How to capture video using intent in Galaxy Tab?

开发者 https://www.devze.com 2023-02-18 20:35 出处:网络
I have an intent that calls the video capture activity: Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

I have an intent that calls the video capture activity:

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
            intent.putExtra(MediaStore.EXTRA_OUTPUT,  Uri.fromFile(videoFile));
            intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
            startA开发者_运维百科ctivityForResult(intent,CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE);

It works fine on my SE X8, but on Galaxy Tab the video capture activity never quits. After I stop recording, there is no button to quit the video capture. Is there any extra parameter I need to set?


Just remove this line:

intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(videoFile));

After that everything worked as expected for me on Galaxy Tab.


Removing

intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(videoFile));

works, but then you will have to capture the uri with

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    if ((requestCode == VIDEO_REQUEST_CODE) && (resultCode == RESULT_OK)) {

        // The URI string is in intent.getData());
    }
}

and move the video to another location if is the functionality you need.

The crazy thing is that MediaStore.EXTRA_OUTPUT works perfectly with ACTION_IMAGE_CAPTURE.


You can prepare your own SurfaceHolder class for this. Just try this link It's wokring perfectly.

0

精彩评论

暂无评论...
验证码 换一张
取 消