Record a video automatically

I need to add and automatic video recording button to my app.
If I click on a button or call a function, it should record automatically for 10 seconds.

And now im trying to do this with :

My problem is that this open the camera app, but not record automatically, u should clik on record button and finish button.

There is a way to record automatically?