mirror of
https://github.com/samsonjs/SwiftyCam.git
synced 2026-04-27 15:07:43 +00:00
Fixed issue with front flash not turning on in time
This commit is contained in:
parent
73bbfa0078
commit
da8f7ba858
4 changed files with 91 additions and 109 deletions
|
|
@ -25,7 +25,7 @@ class ViewController: SwiftyCamViewController, SwiftyCamViewControllerDelegate {
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
cameraDelegate = self
|
cameraDelegate = self
|
||||||
kMaximumVideoDuration = 10.0
|
maximumVideoDuration = 10.0
|
||||||
doubleTapCameraSwitch = true
|
doubleTapCameraSwitch = true
|
||||||
addButtons()
|
addButtons()
|
||||||
|
|
||||||
|
|
@ -39,12 +39,12 @@ class ViewController: SwiftyCamViewController, SwiftyCamViewControllerDelegate {
|
||||||
super.viewDidAppear(animated)
|
super.viewDidAppear(animated)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidTakePhoto(_ photo: UIImage) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didTake photo: UIImage) {
|
||||||
let newVC = PhotoViewController(image: photo)
|
let newVC = PhotoViewController(image: photo)
|
||||||
self.present(newVC, animated: true, completion: nil)
|
self.present(newVC, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidBeginRecordingVideo() {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didBeginRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
|
||||||
print("Did Begin Recording")
|
print("Did Begin Recording")
|
||||||
captureButton.growButton()
|
captureButton.growButton()
|
||||||
UIView.animate(withDuration: 0.25, animations: {
|
UIView.animate(withDuration: 0.25, animations: {
|
||||||
|
|
@ -53,7 +53,7 @@ class ViewController: SwiftyCamViewController, SwiftyCamViewControllerDelegate {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidFinishRecordingVideo() {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
|
||||||
print("Did finish Recording")
|
print("Did finish Recording")
|
||||||
captureButton.shrinkButton()
|
captureButton.shrinkButton()
|
||||||
UIView.animate(withDuration: 0.25, animations: {
|
UIView.animate(withDuration: 0.25, animations: {
|
||||||
|
|
@ -62,14 +62,14 @@ class ViewController: SwiftyCamViewController, SwiftyCamViewControllerDelegate {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidFinishProcessingVideoAt(_ url: URL) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishProcessVideoAt url: URL) {
|
||||||
let newVC = VideoViewController(videoURL: url)
|
let newVC = VideoViewController(videoURL: url)
|
||||||
self.present(newVC, animated: true, completion: nil)
|
self.present(newVC, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidFocusAtPoint(focusPoint: CGPoint) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFocusAtPoint point: CGPoint) {
|
||||||
let focusView = UIImageView(image: #imageLiteral(resourceName: "focus"))
|
let focusView = UIImageView(image: #imageLiteral(resourceName: "focus"))
|
||||||
focusView.center = focusPoint
|
focusView.center = point
|
||||||
focusView.alpha = 0.0
|
focusView.alpha = 0.0
|
||||||
view.addSubview(focusView)
|
view.addSubview(focusView)
|
||||||
|
|
||||||
|
|
@ -86,11 +86,11 @@ class ViewController: SwiftyCamViewController, SwiftyCamViewControllerDelegate {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidChangeZoomLevel(zoomLevel: CGFloat) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didChangeZoomLevel zoom: CGFloat) {
|
||||||
print(zoomLevel)
|
print(zoom)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidSwitchCameras(camera: SwiftyCamViewController.CameraSelection) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didSwitchCameras camera: SwiftyCamViewController.CameraSelection) {
|
||||||
print(camera)
|
print(camera)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
46
README.md
46
README.md
|
|
@ -116,10 +116,10 @@ Capturing Video is just as easy. To begin recording video, call the `startVideoR
|
||||||
startVideoRecording()
|
startVideoRecording()
|
||||||
```
|
```
|
||||||
|
|
||||||
To end the capture of a video, call the `endVideoRecordingFunction`:
|
To end the capture of a video, call the `stopVideoRecording` function:
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
endVideoRecording()
|
stopVideoRecording()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -141,41 +141,41 @@ class MyCameraViewController : SwiftyCamViewController, SwiftyCamViewControllerD
|
||||||
####Delegate methods:
|
####Delegate methods:
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
func SwiftyCamDidTakePhoto(_ photo: UIImage) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didTake photo: UIImage) {
|
||||||
// Called when takePhoto() is called or if a SwiftyCamButton initiates a tap gesture
|
// Called when takePhoto() is called or if a SwiftyCamButton initiates a tap gesture
|
||||||
// Returns a UIImage captured from the current session
|
// Returns a UIImage captured from the current session
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidBeginRecordingVideo() {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didBeginRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
|
||||||
// Called when startVideoRecording() is called
|
// Called when startVideoRecording() is called
|
||||||
// Called if a SwiftyCamButton begins a long press gesture
|
// Called if a SwiftyCamButton begins a long press gesture
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidFinishRecordingVideo() {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
|
||||||
// Called when endVideoRecording() is called
|
// Called when stopVideoRecording() is called
|
||||||
// Called if a SwiftyCamButton ends a long press gesture
|
// Called if a SwiftyCamButton ends a long press gesture
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidFinishProcessingVideoAt(_ url: URL) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishProcessVideoAt url: URL) {
|
||||||
// Called when endVideoRecording() is called and the video is finished processing
|
// Called when stopVideoRecording() is called and the video is finished processing
|
||||||
// Returns a URL in the temporary directory where video is stored
|
// Returns a URL in the temporary directory where video is stored
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidFocusAtPoint(focusPoint: CGPoint) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFocusAtPoint point: CGPoint) {
|
||||||
// Called when a user initiates a tap gesture on the preview layer
|
// Called when a user initiates a tap gesture on the preview layer
|
||||||
// Will only be called if tapToFocus = true
|
// Will only be called if tapToFocus = true
|
||||||
// Returns a CGPoint of the tap location on the preview layer
|
// Returns a CGPoint of the tap location on the preview layer
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidChangeZoomLevel(zoomLevel: CGFloat) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didChangeZoomLevel zoom: CGFloat) {
|
||||||
// Called when a user initiates a pinch gesture on the preview layer
|
// Called when a user initiates a pinch gesture on the preview layer
|
||||||
// Will only be called if pinchToZoomn = true
|
// Will only be called if pinchToZoomn = true
|
||||||
// Returns a CGFloat of the current zoom level
|
// Returns a CGFloat of the current zoom level
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidSwitchCameras(camera: SwiftyCamViewController.CameraSelection) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didSwitchCameras camera: SwiftyCamViewController.CameraSelection) {
|
||||||
// Called if the user denied access to the Camera or Microphone
|
// Called when user switches between cameras
|
||||||
// Will only be called if promptToAppPrivacySettings = false
|
// Returns current camera selection
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -225,9 +225,9 @@ Video quality can be set by the **videoQuality** property of SwiftyCamViewContro
|
||||||
|
|
||||||
| VideoQuality | AVCaptureSessionPreset
|
| VideoQuality | AVCaptureSessionPreset
|
||||||
| ------------------------------------- | ---------------------
|
| ------------------------------------- | ---------------------
|
||||||
| `.high` | **AVCapturePresetHigh**
|
| `.high` | **AVCapturePresetHigh**
|
||||||
| `.medium` | **AVCapturePresetMedium**
|
| `.medium` | **AVCapturePresetMedium**
|
||||||
| `.low` | **AVCapturePresetLow**
|
| `.low` | **AVCapturePresetLow**
|
||||||
| `.resolution352x288` | **AVCaptureSessionPreset352x288**
|
| `.resolution352x288` | **AVCaptureSessionPreset352x288**
|
||||||
| `.resolution640x480` | **AVCaptureSessionPreset640x480**
|
| `.resolution640x480` | **AVCaptureSessionPreset640x480**
|
||||||
| `.resolution1280x720` | **AVCaptureSessionPreset1280x720**
|
| `.resolution1280x720` | **AVCaptureSessionPreset1280x720**
|
||||||
|
|
@ -241,10 +241,10 @@ The default value is **.high**. For use with the front-facing camera, **.high**
|
||||||
|
|
||||||
### Maximum Video Duration
|
### Maximum Video Duration
|
||||||
|
|
||||||
If using a SwiftyCamButton, you can set a maximum video duration for the length of video. The video recording will me automatically stopped once the time limit has been reached and the delegate method `SwiftyCamDidFinishRecordingVideo` will be called. To set this value, simply change the `kMaximumVideoDuration` value:
|
If using a SwiftyCamButton, you can set a maximum video duration for the length of video. The video recording will me automatically stopped once the time limit has been reached and the delegate method `SwiftyCamDidFinishRecordingVideo` will be called. To set this value, simply change the `maximumVideoDuration` value:
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
kMaximumVideoDuration = 10.0
|
maximumVideoDuration = 10.0
|
||||||
```
|
```
|
||||||
|
|
||||||
A value of **0.0** will allow for unlimited video recording via the SwiftyCamButton. The default value is **0.0**.
|
A value of **0.0** will allow for unlimited video recording via the SwiftyCamButton. The default value is **0.0**.
|
||||||
|
|
@ -287,13 +287,7 @@ lowLightBoost = false
|
||||||
|
|
||||||
## Privacy
|
## Privacy
|
||||||
|
|
||||||
When a user firsts launch SwiftyCamViewController, they will be prompted for permission for access to the cameras and microphones. By default, if a user declines access to the hardware, SwiftyCam will provide a prompt to the App privacy settings inside the iOS settings application. If you wish to change this behaviour, the `promptToAppPrivacySettings*`property can be modified:
|
When a user firsts launch SwiftyCamViewController, they will be prompted for permission for access to the cameras and microphones. By default, if a user declines access to the hardware, SwiftyCam will provide a prompt to the App privacy settings inside the iOS settings application.
|
||||||
|
|
||||||
```swift
|
|
||||||
promptToAppPrivacySettings = false
|
|
||||||
```
|
|
||||||
|
|
||||||
Instead of prompting the user to the settings application, the delegate method `SwiftyCamDidFailCameraPermissionSettings` will be called and will have to be manually handled.
|
|
||||||
|
|
||||||
## Miscellaneous
|
## Miscellaneous
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
|
|
||||||
/// Maxiumum video duration if SwiftyCamButton is used
|
/// Maxiumum video duration if SwiftyCamButton is used
|
||||||
|
|
||||||
public var kMaximumVideoDuration : Double = 0.0
|
public var maximumVideoDuration : Double = 0.0
|
||||||
|
|
||||||
/// Video capture quality
|
/// Video capture quality
|
||||||
|
|
||||||
|
|
@ -119,10 +119,6 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
|
|
||||||
public var lowLightBoost = true
|
public var lowLightBoost = true
|
||||||
|
|
||||||
/// Sets whether SwiftyCam will prompt a user to the App Settings Screen if Camera or Microphone access is not authorized
|
|
||||||
|
|
||||||
public var promptToAppPrivacySettings = true
|
|
||||||
|
|
||||||
/// Set whether SwiftyCam should allow background audio from other applications
|
/// Set whether SwiftyCam should allow background audio from other applications
|
||||||
|
|
||||||
public var allowBackgroundAudio = true
|
public var allowBackgroundAudio = true
|
||||||
|
|
@ -368,12 +364,8 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
if currentCamera == .front && flashEnabled == true {
|
if currentCamera == .front && flashEnabled == true {
|
||||||
flashView = UIView(frame: view.frame)
|
flashView = UIView(frame: view.frame)
|
||||||
flashView?.backgroundColor = UIColor.white
|
flashView?.backgroundColor = UIColor.white
|
||||||
flashView?.alpha = 0.0
|
flashView?.alpha = 0.85
|
||||||
previewLayer.addSubview(flashView!)
|
previewLayer.addSubview(flashView!)
|
||||||
UIView.animate(withDuration: 0.1, delay: 0.0, options: .curveEaseInOut, animations: {
|
|
||||||
self.flashView?.alpha = 0.85
|
|
||||||
|
|
||||||
}, completion: nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let videoPreviewLayerOrientation = previewLayer!.videoPreviewLayer.connection.videoOrientation
|
let videoPreviewLayerOrientation = previewLayer!.videoPreviewLayer.connection.videoOrientation
|
||||||
|
|
@ -400,7 +392,7 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
movieFileOutput.startRecording(toOutputFileURL: URL(fileURLWithPath: outputFilePath), recordingDelegate: self)
|
movieFileOutput.startRecording(toOutputFileURL: URL(fileURLWithPath: outputFilePath), recordingDelegate: self)
|
||||||
self.isVideoRecording = true
|
self.isVideoRecording = true
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.cameraDelegate?.SwiftyCamDidBeginRecordingVideo()
|
self.cameraDelegate?.swiftyCam(self, didBeginRecordingVideo: self.currentCamera)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -419,7 +411,7 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public func endVideoRecording() {
|
public func stopVideoRecording() {
|
||||||
if self.movieFileOutput?.isRecording == true {
|
if self.movieFileOutput?.isRecording == true {
|
||||||
self.isVideoRecording = false
|
self.isVideoRecording = false
|
||||||
movieFileOutput!.stopRecording()
|
movieFileOutput!.stopRecording()
|
||||||
|
|
@ -433,7 +425,7 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.cameraDelegate?.SwiftyCamDidFinishRecordingVideo()
|
self.cameraDelegate?.swiftyCam(self, didFinishRecordingVideo: self.currentCamera)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -472,7 +464,7 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
|
|
||||||
self.addInputs()
|
self.addInputs()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.cameraDelegate?.SwiftyCamDidSwitchCameras(camera: self.currentCamera)
|
self.cameraDelegate?.swiftyCam(self, didSwitchCameras: self.currentCamera)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.session.startRunning()
|
self.session.startRunning()
|
||||||
|
|
@ -669,7 +661,7 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
|
|
||||||
// Call delegate and return new image
|
// Call delegate and return new image
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.cameraDelegate?.SwiftyCamDidTakePhoto(image)
|
self.cameraDelegate?.swiftyCam(self, didTake: image)
|
||||||
}
|
}
|
||||||
completionHandler(true)
|
completionHandler(true)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -684,16 +676,6 @@ open class SwiftyCamViewController: UIViewController {
|
||||||
/// Handle Denied App Privacy Settings
|
/// Handle Denied App Privacy Settings
|
||||||
|
|
||||||
fileprivate func promptToAppSettings() {
|
fileprivate func promptToAppSettings() {
|
||||||
guard promptToAppPrivacySettings == true else {
|
|
||||||
// Do not prompt user
|
|
||||||
// Call delegate function SwiftyCamDidFailCameraPermissionSettings()
|
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
self.cameraDelegate?.SwiftyCamDidFailCameraPermissionSettings()
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// prompt User with UIAlertView
|
// prompt User with UIAlertView
|
||||||
|
|
||||||
DispatchQueue.main.async(execute: { [unowned self] in
|
DispatchQueue.main.async(execute: { [unowned self] in
|
||||||
|
|
@ -836,7 +818,7 @@ extension SwiftyCamViewController : SwiftyCamButtonDelegate {
|
||||||
/// Sets the maximum duration of the SwiftyCamButton
|
/// Sets the maximum duration of the SwiftyCamButton
|
||||||
|
|
||||||
public func setMaxiumVideoDuration() -> Double {
|
public func setMaxiumVideoDuration() -> Double {
|
||||||
return kMaximumVideoDuration
|
return maximumVideoDuration
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set UITapGesture to take photo
|
/// Set UITapGesture to take photo
|
||||||
|
|
@ -855,13 +837,13 @@ extension SwiftyCamViewController : SwiftyCamButtonDelegate {
|
||||||
|
|
||||||
|
|
||||||
public func buttonDidEndLongPress() {
|
public func buttonDidEndLongPress() {
|
||||||
endVideoRecording()
|
stopVideoRecording()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called if maximum duration is reached
|
/// Called if maximum duration is reached
|
||||||
|
|
||||||
public func longPressDidReachMaximumDuration() {
|
public func longPressDidReachMaximumDuration() {
|
||||||
endVideoRecording()
|
stopVideoRecording()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -884,7 +866,7 @@ extension SwiftyCamViewController : AVCaptureFileOutputRecordingDelegate {
|
||||||
} else {
|
} else {
|
||||||
//Call delegate function with the URL of the outputfile
|
//Call delegate function with the URL of the outputfile
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.cameraDelegate?.SwiftyCamDidFinishProcessingVideoAt(outputFileURL)
|
self.cameraDelegate?.swiftyCam(self, didFinishProcessVideoAt: outputFileURL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -911,7 +893,7 @@ extension SwiftyCamViewController {
|
||||||
|
|
||||||
// Call Delegate function with current zoom scale
|
// Call Delegate function with current zoom scale
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.cameraDelegate?.SwiftyCamDidChangeZoomLevel(zoomLevel: self.zoomScale)
|
self.cameraDelegate?.swiftyCam(self, didChangeZoomLevel: self.zoomScale)
|
||||||
}
|
}
|
||||||
|
|
||||||
captureDevice?.unlockForConfiguration()
|
captureDevice?.unlockForConfiguration()
|
||||||
|
|
@ -949,7 +931,7 @@ extension SwiftyCamViewController {
|
||||||
//Call delegate function and pass in the location of the touch
|
//Call delegate function and pass in the location of the touch
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.cameraDelegate?.SwiftyCamDidFocusAtPoint(focusPoint: tapPoint)
|
self.cameraDelegate?.swiftyCam(self, didFocusAtPoint: tapPoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|
|
||||||
|
|
@ -23,97 +23,103 @@ import UIKit
|
||||||
public protocol SwiftyCamViewControllerDelegate {
|
public protocol SwiftyCamViewControllerDelegate {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SwiftyCamViewControllerDelegate function called when the takePhoto() function is called
|
SwiftyCamViewControllerDelegate function called when the takePhoto() function is called.
|
||||||
|
|
||||||
|
- Parameter swiftyCam: Current SwiftyCamViewController session
|
||||||
- Parameter photo: UIImage captured from the current session
|
- Parameter photo: UIImage captured from the current session
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didTake photo: UIImage)
|
||||||
func SwiftyCamDidTakePhoto(_ photo:UIImage)
|
|
||||||
|
|
||||||
/// SwiftyCamViewControllerDelegate function called when SwiftyCamViewController begins recording video
|
|
||||||
|
|
||||||
func SwiftyCamDidBeginRecordingVideo()
|
|
||||||
|
|
||||||
/// SwiftyCamViewControllerDelegate function called when SwiftyCamViewController finishes recording video
|
|
||||||
|
|
||||||
func SwiftyCamDidFinishRecordingVideo()
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SwiftyCamViewControllerDelegate function called when SwiftyCamViewController is done processing video
|
SwiftyCamViewControllerDelegate function called when SwiftyCamViewController begins recording video.
|
||||||
|
|
||||||
|
- Parameter swiftyCam: Current SwiftyCamViewController session
|
||||||
|
- Parameter camera: Current camera orientation
|
||||||
|
*/
|
||||||
|
|
||||||
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didBeginRecordingVideo camera: SwiftyCamViewController.CameraSelection)
|
||||||
|
|
||||||
|
/**
|
||||||
|
SwiftyCamViewControllerDelegate function called when SwiftyCamViewController finishes recording video.
|
||||||
|
|
||||||
|
- Parameter swiftyCam: Current SwiftyCamViewController session
|
||||||
|
- Parameter camera: Current camera orientation
|
||||||
|
*/
|
||||||
|
|
||||||
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishRecordingVideo camera: SwiftyCamViewController.CameraSelection)
|
||||||
|
|
||||||
|
/**
|
||||||
|
SwiftyCamViewControllerDelegate function called when SwiftyCamViewController is done processing video.
|
||||||
|
|
||||||
|
- Parameter swiftyCam: Current SwiftyCamViewController session
|
||||||
- Parameter url: URL location of video in temporary directory
|
- Parameter url: URL location of video in temporary directory
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func SwiftyCamDidFinishProcessingVideoAt(_ url: URL)
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishProcessVideoAt url: URL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SwiftyCamViewControllerDelegate function called when SwiftyCamViewController switches between front or rear camera
|
SwiftyCamViewControllerDelegate function called when SwiftyCamViewController switches between front or rear camera.
|
||||||
|
|
||||||
|
- Parameter swiftyCam: Current SwiftyCamViewController session
|
||||||
- Parameter camera: Current camera selection
|
- Parameter camera: Current camera selection
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func SwiftyCamDidSwitchCameras(camera: SwiftyCamViewController.CameraSelection)
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didSwitchCameras camera: SwiftyCamViewController.CameraSelection)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SwiftyCamViewControllerDelegate function called when SwiftyCamViewController view is tapped and begins focusing at that point
|
SwiftyCamViewControllerDelegate function called when SwiftyCamViewController view is tapped and begins focusing at that point.
|
||||||
|
|
||||||
- Parameter focusPoint: Location in view where camera focused
|
- Parameter swiftyCam: Current SwiftyCamViewController session
|
||||||
|
- Parameter point: Location in view where camera focused
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func SwiftyCamDidFocusAtPoint(focusPoint: CGPoint)
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFocusAtPoint point: CGPoint)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
SwiftyCamViewControllerDelegate function called when when SwiftyCamViewController view changes zoom level
|
SwiftyCamViewControllerDelegate function called when when SwiftyCamViewController view changes zoom level.
|
||||||
|
|
||||||
- Parameter zoomLevel: Current zoom level
|
|
||||||
|
|
||||||
|
- Parameter swiftyCam: Current SwiftyCamViewController session
|
||||||
|
- Parameter zoom: Current zoom level
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func SwiftyCamDidChangeZoomLevel(zoomLevel: CGFloat)
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didChangeZoomLevel zoom: CGFloat)
|
||||||
|
|
||||||
|
|
||||||
/// SwiftyCamViewControllerDelegate function called if app permissions are denied for either Camera or Microphone
|
|
||||||
|
|
||||||
func SwiftyCamDidFailCameraPermissionSettings()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension SwiftyCamViewControllerDelegate {
|
public extension SwiftyCamViewControllerDelegate {
|
||||||
|
|
||||||
func SwiftyCamDidTakePhoto(_ photo:UIImage) {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didTake photo: UIImage) {
|
||||||
// Optional
|
// Optional
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidBeginRecordingVideo() {
|
|
||||||
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didBeginRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
|
||||||
// Optional
|
// Optional
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidFinishRecordingVideo() {
|
|
||||||
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
|
||||||
// Optional
|
// Optional
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidFinishProcessingVideoAt(_ url: URL) {
|
|
||||||
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishProcessVideoAt url: URL) {
|
||||||
// Optional
|
// Optional
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidSwitchCameras(camera: SwiftyCamViewController.CameraSelection) {
|
|
||||||
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didSwitchCameras camera: SwiftyCamViewController.CameraSelection) {
|
||||||
// Optional
|
// Optional
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidFocusAtPoint(focusPoint: CGPoint) {
|
|
||||||
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFocusAtPoint point: CGPoint) {
|
||||||
// Optional
|
// Optional
|
||||||
}
|
}
|
||||||
|
|
||||||
func SwiftyCamDidChangeZoomLevel(zoomLevel: CGFloat) {
|
|
||||||
// Optional
|
|
||||||
}
|
|
||||||
|
|
||||||
func SwiftyCamDidFailCameraPermissionSettings() {
|
func swiftyCam(_ swiftyCam: SwiftyCamViewController, didChangeZoomLevel zoom: CGFloat) {
|
||||||
// Optional
|
// Optional
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue