darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 136 forks source link

How to call intent for ACTION_VIDEO_CAPTURE #56

Closed cfguimaraes closed 6 years ago

cfguimaraes commented 6 years ago

First of all, sorry for my poor English.

I'm trying to call startActivityForResult to capture vídeo, without success :(

Google a lot of hours, read source code and can't figure how to use this plugin to call Photo & Video register Action.

darryncampbell commented 6 years ago
    window.plugins.intentShim.startActivityForResult(
        {
            action: "android.media.action.VIDEO_CAPTURE",
            requestCode: 1
        },
        function(intent)
        {
            if (intent.extras.requestCode == 1 && intent.extras.resultCode == window.plugins.intentShim.RESULT_OK)
            {
                console.log('Recorded video: ' + intent.data);
            }
            else
            {
                console.log('Record video canceled');
            }
        },
        function()
        {
            console.log('Record video failure');
        }
    );

You would then need to handle intent.data in the same way as https://developer.android.com/training/camera/videobasics. I'm not entirely sure how to do that in Cordova

darryncampbell commented 6 years ago

Closing the issue, assumed resolved.