user2312896
user2312896

Reputation: 389

iOS Swift - Save video automatically using UIImagePickerController

In my current code (using Swift 3, iOS 10, Xcode 8.2.1), I am trying to record multiple videos in a loop using UIImagePickerController, without user interaction.

Currently I am able to start and stop video capturing using startVideoCapture() and stopVideoCapture() methods, and getting the information of video in didFinishPickingMediaWithInfo. But didFinishPickingMediaWithInfo is being called only after user clicks on 'Use Video' button shown on UI.

Is there anyway I can get the video data and continue recording again without having user to click on 'Use Video' option? Or is there a way to trigger didFinishPickingMediaWithInfo method once stopVideoCapture() is being called?

Thanks for the help!

Upvotes: 1

Views: 1182

Answers (1)

user2312896
user2312896

Reputation: 389

So I figured it out based on the discussion here which I found from this post- Record a video automatically for 15 secs and save it to directory

Basically, if you are hiding the controls, cameraController.showsCameraControls = false , then it will trigger didFinishPickingMediaWithInfo after you call stopVideoCapture().

Though it would be interesting to know if didFinishPickingMediaWithInfo can be triggered even when camera controls are being shown.

Upvotes: 1

Related Questions