Coder Social home page Coder Social logo

awalz / swiftycam Goto Github PK

View Code? Open in Web Editor NEW
2.1K 67.0 325.0 1.88 MB

A Snapchat Inspired iOS Camera Framework written in Swift

License: BSD 2-Clause "Simplified" License

Swift 97.88% Ruby 1.47% Objective-C 0.65%
video-capture camera video-recording flash image-capture snapchat photos retina-flash avfoundation

swiftycam's Introduction

Platform: iOS 8+ Language: Swift 4.2 CocoaPods compatible License: BSD

Overview

SwiftyCam is a a simple, Snapchat-style iOS Camera framework for easy photo and video capture. SwiftyCam allows users to capture both photos and videos from the same session with very little configuration.

Configuring a Camera View Controller in AVFoundation can be tedious and time consuming. SwiftyCam is a drop in View Controller which gives complete control of the AVSession.

For Swift 4 support, see Swift4 branch

Features

SwiftyCam
๐Ÿ˜Ž Snapchat-style media capture
๐Ÿ‘ Support iOS8+
๐Ÿ“ท Image capture
๐ŸŽฅ Video capture
๐Ÿ“ˆ Manual image quality settings
๐ŸŽ‰ Front and rear camera support
๐Ÿ”ฆ Front and rear flash
โ˜€๏ธ Retina flash support
๐Ÿ”Ž Supports manual zoom
๐Ÿ”’ Supports manual focus
๐ŸŒœ Low light setting
๐Ÿ”ˆ Background audio support

Requirements

  • iOS 8.0+
  • Swift 4.2+

License

SwiftyCam is available under the BSD license. See the LICENSE file for more info.

Installation

Cocoapods:

SwiftyCam is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SwiftyCam"

Add this to Cartfile

github "Awalz/SwiftyCam" ~> 2.2.1
$ carthage update SwiftyCam

Manual Installation:

Simply copy the contents of the Source folder into your project.

Usage

Using SwiftyCam is very simple.

Prerequisites:

As of iOS 10, Apple requires the additon of the NSCameraUsageDescription and NSMicrophoneUsageDescription strings to the info.plist of your application. Example:

<key>NSCameraUsageDescription</key>
	<string>To Take Photos and Video</string>
<key>NSMicrophoneUsageDescription</key>
	<string>To Record Audio With Video</string>

Getting Started:

If you install SwiftyCam from Cocoapods, be sure to import the module into your View Controller:

import SwiftyCam

SwiftyCam is a drop-in convenience framework. To create a Camera instance, create a new UIViewController subclass. Replace the UIViewController subclass declaration with SwiftyCamViewController:

class MyCameraViewController : SwiftyCamViewController

That is all that is required to setup the AVSession for photo and video capture. SwiftyCam will prompt the user for permission to use the camera/microphone, and configure both the device inputs and outputs.

Capture

SwiftyCamButton:

SwiftyCam comes with a very convenient method of capturing media. SwiftyCamButton captures photos with a UITapGestureRecognizer and captures video with a UILongPressGestureRecognizer

To use a SwiftyCamButton, simply create one and assign the delegate to your SwiftyCamViewController:

let captureButton = SwiftyCamButton(frame: buttonFrame)
captureButton.delegate = self

Manual:

Capturing media with SwiftyCam is very simple. To capture a photo, simply call the takePhoto function:

takePhoto()

Capturing Video is just as easy. To begin recording video, call the startVideoRecording function:

startVideoRecording()

To end the capture of a video, call the stopVideoRecording function:

stopVideoRecording()

Delegate

In order to acquire the photos and videos taken by either the SwiftyCamButton or manually, you must implement the SwiftyCamViewControllerDelegate and set the cameraDelegate to your view controller instance:

class MyCameraViewController : SwiftyCamViewController, SwiftyCamViewControllerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        cameraDelegate = self
    }
    ...
}

Delegate methods:

func swiftyCam(_ swiftyCam: SwiftyCamViewController, didTake photo: UIImage) {
     // Called when takePhoto() is called or if a SwiftyCamButton initiates a tap gesture
     // Returns a UIImage captured from the current session
}

func swiftyCam(_ swiftyCam: SwiftyCamViewController, didBeginRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
     // Called when startVideoRecording() is called
     // Called if a SwiftyCamButton begins a long press gesture
}

func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishRecordingVideo camera: SwiftyCamViewController.CameraSelection) {
     // Called when stopVideoRecording() is called
     // Called if a SwiftyCamButton ends a long press gesture
}

func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFinishProcessVideoAt url: URL) {
     // Called when stopVideoRecording() is called and the video is finished processing
     // Returns a URL in the temporary directory where video is stored
}

func swiftyCam(_ swiftyCam: SwiftyCamViewController, didFocusAtPoint point: CGPoint) {
     // Called when a user initiates a tap gesture on the preview layer
     // Will only be called if tapToFocus = true
     // Returns a CGPoint of the tap location on the preview layer
}

func swiftyCam(_ swiftyCam: SwiftyCamViewController, didChangeZoomLevel zoom: CGFloat) {
	  // Called when a user initiates a pinch gesture on the preview layer
	  // Will only be called if pinchToZoomn = true
	  // Returns a CGFloat of the current zoom level
}

func swiftyCam(_ swiftyCam: SwiftyCamViewController, didSwitchCameras camera: SwiftyCamViewController.CameraSelection) {
     // Called when user switches between cameras
     // Returns current camera selection   
}

Flash

The flash(torch) can be enabled by changing the flashEnabled property:

flashEnabled = true

Flash is now supported for front and rear facing cameras.

Rear Camera

For photos, the camera will flash much like the stock iOS camera. For video, the torch(flash) will enable for the duration of the video capture.

Front Camera

For models that support Retina Flash, the front camera will use the default flash for image capture. If Retina Flash is not supported, a faux Retina Flash is used similar to Snapchat.

For front facing videos, a white, 85% opaque view will be placed over the video feed for the duration of the video capture.

Switching Camera

By default, SwiftyCam will launch to the rear facing camera. This can be changed by changing the defaultCamera property in viewDidLoad:

override func viewDidLoad() {
    super.viewDidLoad()
    defaultCamera = .front
    ...
}

SwiftyCam supports capture from both the front and back cameras. To switch cameras, call the function:

switchCamera()

Tap-to-focus, pinch-to-zoom and camera flash are not supported when the front facing camera is selected. Switching video while video is being recorded is not currently supported

SwiftyCam also enables switching between cameras with a double tap gesture. To disable this feature, use the doubleTapCameraSwitch property:

doubleTapCameraSwitch = false

Configuration

SwiftyCam has several options for configurating the functionality of the capture:

Video Quality

Video quality can be set by the videoQuality property of SwiftyCamViewController. The choices available correspond to the matching AVCaptureSessionPreset:

VideoQuality AVCaptureSessionPreset
.high AVCapturePresetHigh
.medium AVCapturePresetMedium
.low AVCapturePresetLow
.resolution352x288 AVCaptureSessionPreset352x288
.resolution640x480 AVCaptureSessionPreset640x480
.resolution1280x720 AVCaptureSessionPreset1280x720
.resolution1920x1080 AVCaptureSessionPreset1920x1080
.resolution3840x2160 AVCaptureSessionPreset3840x2160
.iframe960x540 AVCaptureSessionPresetiFrame960x540
.iframe1280x720 AVCaptureSessionPresetiFrame1280x720

The default value is .high. For use with the front-facing camera, .high will always be used.

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 maximumVideoDuration value:

maximumVideoDuration = 10.0

A value of 0.0 will allow for unlimited video recording via the SwiftyCamButton. The default value is 0.0.

Camera Zoom

SwiftyCam supports digital zoom of the camera session via pinch and pan gestures. The gestures work similar to the default iOS app and will zoom to the maximum supported zoom level. Camera zoom is only supported on the rear facing camera. AVFoundation does not currently support front facing camera zoom. To disable this feature, change the pinchToZoom property:

pinchToZoom = false

By default, pinchToZoom is enabled.

SwiftyCam also supports the ability to zoom the rear facing camera with vertical pan gestures. To disable this feature, change the swipeToZoom property:

swipeToZoom = false

By default, swipeToZoom is enabled. The default gestures zoom in the capture session with a downward swipe, and zoom out with an upward swipe. This can be reversed by changing the swipeToZoomInverted property:

swipeToZoomInverted = true

You can also restrict the amount that the rear facing camera can zoom. To do this, use the maxZoomScale property:

maxZoomScale = 2.0

By default, maxZoomScale is set to infinite. The actual maximum zoom level is determined by the device's videoMaxZoomFactor.

Camera Focus

SwiftyCam, by default, support tap to focus on the video preview. SwiftyCam will set the focus and exposure levels of the session to the tapped point. While tap to set exposure is supported on both cameras, tap to focus is only supported on rear facing cameras. Autofocus and autoexposure will be resumed once SwiftyCam detects significant movement from the tapped point. To disable this feature, change the tapToFocus property:

tapToFocus = false

By default, tapToFocus is enabled. If you wish to show a on screen animation when a tap to focus is initiated, you can use the SwiftyCamDidFocusAtPoint(focusPoint:) to get the coordinates of tap and provide your own tap animation

Device Orientation

By default, SwiftyCam will set the photo orientation to be portrait. If you wish to preserve the orientation of the capture photos to allow support for landscape images, use the shouldUseDeviceOrientation property:

shouldUseDeviceOrientation = true

Background Audio

SwiftyCam has the ability to allow background audio to continue playing within the session, and to be captured by the video recording. By default, this is enabled. If you wish to disable this feature, change the allowBackgroundAudio property:

allowBackgroundAudio = false

Low Light Boost

For supported models (iPhone 5 and 5C), AVCaptureDevice supports a low light boost when it is detected that the capture session is in a low light area. By default, this is set to true. It can be modified with the lowLightBoost variable:

lowLightBoost = false

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.

Miscellaneous

Other properties:

  • isCameraFlashOn - Boolean
  • isVideoRecording - Boolean
  • isSessionRunning - Boolean
  • currentCamera - CameraSelection

Contact

If you have any questions, requests, or enhancements, feel free to submit a pull request, create an issue, or contact me in person:

Andrew Walz [email protected]

swiftycam's People

Contributors

awalz avatar dadalar avatar jcsplash avatar jonandersen avatar lm2s avatar nellthu avatar olivanov avatar petermarathas avatar ryandailey100 avatar satoshin21 avatar superandrew avatar thebigkhaled avatar vincentattently avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftycam's Issues

Saving photos to camera roll.

Quick question - how do add a button to save images to the camera roll?

Fixed it.

func save() {
UIImageWriteToSavedPhotosAlbum(backgroundImage, nil, nil, nil)

}

Show camera on only half of the screen

I tried to implement this library on my app, but the camera shows on only half of the screen.
Why is this happened?
I'm using Swift 3.0.2, iOS 10.2, and iPhone 5s.

img_0083

Thanks.

Swipe up for camera roll/button to access camera roll

Would be nice to have the option to pick an image/video from the camera roll without having to exit the swifty cam controller. The functionality could be a camera roll icon and a swipe up to drag the camera roll up

Using Storyboards?

While I love this component and how simple it is, I'm having quite a weird situation...
I've got everything working as per the demo example, but there is a thing that keeps me bothering, and it's creating the buttons in runtime with fixed frames. Since I hate working with constraints in code I decided to build a simple XIB and setup the buttons there.
The problem is that the previewView hides the buttons! From what I understand, the previewView is added later on, so it covers everything that's there; so adding the buttons after view did load manages to put the buttons above.
For now I'm gonna try moving the buttons to front, but is there any other way?

Make all buttons @IBDesignable?

I wanted to subclass SwiftyCamButton to re-draw and make it @IBDesignable but was encountering a lot of issues. Not sure if there's a better way to do this. But I ended up had to edit SwiftyCamButton.swift to put #if !TARGET_INTERFACE_BUILDER around a whole bunch of stuff in the class to make my subclass work.

/// UIButton Subclass for Capturing Photo and Video with SwiftyCamViewController

open class SwiftyCamButton: UIButton {
    
    /// Maximum duration variable
    
    fileprivate var timer : Timer?
    
    /// Initialization Declaration
    
    override public init(frame: CGRect) {
        super.init(frame: frame)
      #if !TARGET_INTERFACE_BUILDER
        createGestureRecognizers()
      #endif
    }
    
    /// Initialization Declaration

    
    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
      #if !TARGET_INTERFACE_BUILDER
        createGestureRecognizers()
      #endif
    }

  #if !TARGET_INTERFACE_BUILDER
    /// Delegate variable
  
    public var delegate: SwiftyCamButtonDelegate?
  
    /// UITapGestureRecognizer Function
    
    @objc fileprivate func Tap() {
       self.delegate?.buttonWasTapped()
    }
    
    /// UILongPressGestureRecognizer Function

    @objc fileprivate func LongPress(_ sender:UILongPressGestureRecognizer!)  {
        if (sender.state == UIGestureRecognizerState.ended) {
            invalidateTimer()
            self.delegate?.buttonDidEndLongPress()
        } else if (sender.state == UIGestureRecognizerState.began) {
            self.delegate?.buttonDidBeginLongPress()
            startTimer()
        }
    }
    
    /// Timer Finished
    
    @objc fileprivate func timerFinished() {
        invalidateTimer()
        self.delegate?.longPressDidReachMaximumDuration()
    }
    
    /// Start Maximum Duration Timer
    
    fileprivate func startTimer() {
        if let duration = delegate?.setMaxiumVideoDuration() {
            //Check if duration is set, and greater than zero
            if duration != 0.0 && duration > 0.0 {
                timer = Timer.scheduledTimer(timeInterval: duration, target: self, selector:  #selector(SwiftyCamButton.timerFinished), userInfo: nil, repeats: false)
            }
        }
    }
    
    // End timer if UILongPressGestureRecognizer is ended before time has ended
    
    fileprivate func invalidateTimer() {
        timer?.invalidate()
        timer = nil
    }
    
    // Add Tap and LongPress gesture recognizers
    
    fileprivate func createGestureRecognizers() {
        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(SwiftyCamButton.Tap))
        let longGesture = UILongPressGestureRecognizer(target: self, action: #selector(SwiftyCamButton.LongPress))
        self.addGestureRecognizer(tapGesture)
        self.addGestureRecognizer(longGesture)
    }
  #endif
}

Would be great to know if there's a better way to do this. Or if there can be native support for IBDesignable compatibility. Thanks!

Single Tap problem

Hi @Awalz,

I commented some lines on SwiftyCamButton.swift file.

Like; let tapGesture and self.addGestureRecognizer(tapGesture) but single tap still working. This triggers longGesture.

Why? I Updated pod and i have this problem.

Thanks

Unable to capture media

When push camera viewcontroller, I could see the following message.

Domain=AVFoundationErrorDomain Code=-11814 "Cannot Record" UserInfo={NSLocalizedRecoverySuggestion=Try recording again., NSLocalizedDescription=Cannot Record}

What should I fix?

Start the viewController with front cam

Hey,

This is a wonderful library, thank you for this.

I have problem. I want to start my camera view controller with the front camera. If I invoke switchCamera() in viewDidLoad or viewWillAppear:animated, the app crashes with the following message:

[AVCaptureSession stopRunning] stopRunning may not be called between calls to beginConfiguration and commitConfiguration

I assumed that switchCamera() stopped the session when it was still being configured.

Then , I tried to set the currentCamera property to .front, but, that property's setter is private.

Am I missing a way to do this?

Some Suggestion...

Some feedback for the SwiftyCam:

  1. Disable Zoom when switching to front Camera (It doesn't zoom but the values change in the console, and when I switch to back camera and when I start to zoom it goes immediately at the highest value where I left from front camera.

  2. Changing Icon when the light is on and off.

  3. Disabling flash icon on front camera or taking a flash (like the iPhone camera or like snap)

  4. When recording making an animation like Snapchat that you are recording (the red circle animated).

  5. What do you think making a double tap to change the camera from back to front and vice versa.

Thanks

Only capture audio while recording video

The default behavior of the SnapChat camera is to only add the audio capture device and change the audio session category once video capture begins. This is a great UX and would love to see it added to SwiftyCam.

Adding SwiftyCamButton

I am new to SwiftyCam, but love the idea. I wanted to add the SwiftyCamButton as it says in the READ.ME and I followed what it said, but when I run the app on my phone, all I see is the AVcaptureSession open, and I cannot see the button.
here is my code
`override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

    //SwiftyCam
    let buttonFrame = CGRect(x: 200, y: 600, width: 200, height: 200)
    let captureButton = SwiftyCamButton(frame: buttonFrame)

    cameraDelegate = self
    captureButton.delegate = self
    
}`

Any help would be appreciated thanks

Delegates are strong and causing retain cycle

Perhaps I am using it incorrectly, but the delegates SwiftyCamButtonDelegate and SwiftyCamViewControllerDelegate are defined as strong references and were causing a retain cycle for me.

public weak var delegate: SwiftyCamButtonDelegate?
public protocol SwiftyCamButtonDelegate : class

fixed it for me.

Crash when fast-tapping multiple times to switch cameras

I can reproduce this one-hundred percent of time. When I open the SwiftyCam view and fast-tap multiple times on the screen (to switch cameras) the app crashes after 5th or 6th tap on iPhone 6s. How could I prevent this from happening? Or is this a major issue maybe?

This is the error output:

2017-04-24 14:17:45.484928+0200 Slothy[7313:1391058] *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** -[AVCaptureSession stopRunning] stopRunning may not be called between calls to beginConfiguration and commitConfiguration'

Shuttering option

@Awalz I love your project very much, but I'm having a problem. Instead of taking one photo and presenting the next viewcontroller the image. I want the user to hold down on the camera button and burst of images will be taken until they let go of the camera button. Once they let go, the array of images taken will be passed onto the next view controller. Can you please implement this

Can I buy you a beer?

I really appreciate the effort you put into this project and making it open source. Does the email you included on the README map to a PayPal account by chance?

Use as photo capture device only

Is it possible to use the library only for photo capturing?
At the moment it requests permission to the microphone, but I do not want the users to see such request at all, as I will not record videos. Is this possible with the current implementation?

Having trouble switching cameras

I cant seem to get the cameras to switch properly. When i switch the camera, i just get a black screen and everything becomes unresponsive. Any way to fix this?

Flash not working + Usage needs update?

I cloned DemoSwiftyCam and tried it on my iPhone 5S but the flash is not working. Is this a framework bug or can you recommend a way to implement it?

Also, comparing the usage instructions on README.md to the DemoSwiftyCam project, I can see that they are not coherent. Do you recommend to continue using the logic on DemoSwiftyCam?

Thanks in advance!

Disabling automatic saving

I want to create a button to save the photo after it's taken rather than it automatically being saved but I can't find the code that's making that happen. I was assuming it would be in the takePhoto() function but I can't pick up on it. Can you help? Thanks.

Confused your project with another. This is absolutely perfect! Thanks for your hard work. Issue closed. Best.

Is there any way to completely remove whatever makes it ask for microphone permission?

Hello,

I'm building a database with SwiftyCam and I've been having some problems uploading the videos to my server but the pictures work fine. So right now I want to just go with photo upload as I have removed the ability for users to create videos (I'd really love adding this back one day). Everything is fine but it's kind of creepy that my app asks for microphone permission but doesn't utilize it.

I've removed some of the privacy settings in the info.plist related to this, however as you may already know, it just removed the details/reason for asking for permission but the notification still persists. Are you able to tell me what triggers SwiftyCam to ask for this permission and how I can remove it for now?

I've tried removing some AVCaptureSession() stuff but it pretty much breaks everything - I'm hoping the solution is a one-liner.

Thanks for any help, I absolutely love all the hard work you put into this.

Consecutive Taps Crash

Hey there,

When doubleTapCameraSwitch is enabled, tapping a few extra times consecutively causes an error:
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** -[AVCaptureSession stopRunning] stopRunning may not be called between calls to beginConfiguration and commitConfiguration'

Thanks,
Qianen

Swift 2.3

Is there anyway this can be translated to swift 2.3? My whole app is in that version and I'm a bit of a newbie. Thanks!

Video Recording Long Press Gesture Problem

Hi Andrew,

I have a problem while video recording. As follows:
Very short Long press duration on SwiftyCamButton causes endless video recording.
In my debug session, I saw all UIGestureRecognizerState.began and UIGestureRecognizerState.ended state code blocks called. But recording never stopped

Thanks for help

Flash not working

I am having issues getting the flash to work on the latest build. When I set flashEnabled = true , it does nothing. Any idea why this doesnt work?

EDIT: This ended up being something on my end. Sorry about that! Flash is working just as expected.

SwiftyCamViewControllerDelegate style issue

This is a style issue more than anything... The usual way of writing swift functions is with lower camel case. In the case of SwiftyCamViewControllerDelegate, the functions are declared with upper camel case as in:

func SwiftyCamDidTakePhoto(_ photo:UIImage).

My suggestion would be to change the signatures to:

func swiftyCam(_ swiftyCam:SwiftyCamViewController, didTake photo:UIImage),

or something along those lines to align with Apple's practices for declaring delegate methods.

SwiftyRecordButton

Will you add the SwiftyRecordButton into the library as you have in the demo?

Switching Cameras While Recording

I am looking for help implementing Switching cameras between front and rear camera. This will require a rewrite to use AVCaptureVideoDataOutput and knowledge of AVAssetReader and AVAssetWriter. Any help would be appreciated!

SwiftyCamDidTakePhoto returns rotated image

I noticed a small bug when taking a picture with the front facing camera. The image that gets returned is rotated 180 degrees. This is only the case when taking the picture with the front facing camera, not the rear camera.

Square photo

Hi,

It's possible to change the photo capture aspect ratio to 1:1 without cropping the output ?

Thanks

Background Music Issues

When I open the camera view controller, the music that is playing immediately stops. When I manage to get music and the camera running, switching the camera from back to front freezes the preview. Is there a reason for this? Thanks in advance!

PreviewLayer view sometimes doesnt Fill Screen

@Awalz
This happens randomly, but when I load the CameraViewController, from time to time, the previewLayer frame doesnt not extend to the bounds of my screen.

I havent done any modification to the library, simply subclassed SwiftyCamViewController with these settings in viewDidLoad

Update** I dont know if this could perhaps be the problem previewLayer = PreviewView(frame: self.view.frame). I once read somewhere that you should always use view.bounds not frame but I have yet to test.

// In viewDidLoad
func cameraSettings() {
        cameraDelegate = self
        defaultCamera = .front
        videoQuality = .medium
        pinchToZoom = false
        flashEnabled = false
        doubleTapCameraSwitch = false
    }

img_4528
img_4527

Front flash bug

When taking a front facing picture in the dark with flash on, the flash only shows for a brief second, and goes away before the picture is even taken, resulting in a dark photo. Any way to make the flash last until the picture is taken?

Disable Shutter sound when taking Photo

@Awalz
Is it possible to disable the shutter sound when the takePhoto method is called?

In my usecase, while user is recording, at some point I also takePhoto. That way at output I have both a video and a thumbnail photo. But I dont want the take photo sound to go off.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.