2016-10-09 5 views
3

빠른 응용 프로그램에서 10 초 대기 후 카메라로 비디오 녹화를 시작하고 싶습니다. 10 초 이상,이 함수가 호출되어 대기되면x 초 후 iphone 비디오 녹화 시작

는 : 사용자가 "레코드 비디오 버튼"을 클릭하면

func startRecording() { 
    // trigger video recording 
} 

지금까지, 그것은 카메라 인터페이스를 표시하고, 사용자는 있었다

내가 할 노력하고있어
@IBAction func recordVideo(sender: AnyObject) { 
     if (UIImagePickerController.isSourceTypeAvailable(.Camera)) { 
      if UIImagePickerController.availableCaptureModesForCameraDevice(.Rear) != nil { 
       imagePicker.sourceType = .Camera 
       imagePicker.mediaTypes = [kUTTypeMovie as String] 
       imagePicker.allowsEditing = false 
       imagePicker.delegate = self 
       locationManager.startUpdatingLocation() 
       print(locationManager.location) 
       presentViewController(imagePicker, animated: true, completion: {}) 
      } else { 
       postAlert("Rear camera doesn't exist", message: "Application cannot access the camera.") 
      } 
     } else { 
      postAlert("Camera inaccessible", message: "Application cannot access the camera.") 
     } 
    } 

은 자동으로 녹화를 트리거되면, "레코드 비디오 버튼"10 초 후에는 맞았다 : 내장 된 녹음 버튼을 클릭합니다.

녹음을 "트리거하는"방법에 대한 정보를 찾을 수 없습니다. 이렇게하는 방법이 있습니까? 당신의 도움에 대한

감사

답변

1

당신은 UIImagePickerController을 제시 한 후이를 추가 할 수 있습니다

imagePicker.performSelector(#selector(UIImagePickerController.startVideoCapture), withObject: nil, afterDelay: 10)