Giter VIP home page Giter VIP logo

swiftycam's People

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  avatar

swiftycam's Issues

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!

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.

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

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?

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.

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?

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.

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?

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!

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!

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?

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

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

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.

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.

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.

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?

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.

SwiftyRecordButton

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

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

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?

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)

}

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.

Square photo

Hi,

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

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 + 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!

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

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'

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?

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

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!

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.

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

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.