All Projects → Awalz → Swiftycam

Awalz / Swiftycam

Licence: bsd-2-clause
A Snapchat Inspired iOS Camera Framework written in Swift

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to Swiftycam

Simple Camera
Quick photo and video camera with a flash, customizable resolution and no ads.
Stars: ✭ 503 (-73.23%)
Mutual labels:  camera, photos, flash
Gncam
📷 A Swift 3 library for interacting with the camera on iOS using AVFoundation
Stars: ✭ 42 (-97.76%)
Mutual labels:  camera, photos, avfoundation
Hybridcamera
Video and photo camera for iOS
Stars: ✭ 145 (-92.28%)
Mutual labels:  snapchat, camera, avfoundation
Ios tips
iOS的一些示例,持续更新中:1、AVFoundation 高仿微信相机拍摄和编辑 2、AVFoundation 人脸检测、实时滤镜、音视频编解码、GPUImage框架的使用等音视频相关内容 3、OpenGLES 4、LeetCode算法练习 5、iOS Crash防护和APM监控 6、WKWebView相关的内容 等........
Stars: ✭ 896 (-52.32%)
Mutual labels:  camera, avfoundation, video-recording
Agimagecontrols
cool tools for image edition
Stars: ✭ 217 (-88.45%)
Mutual labels:  camera, photos, avfoundation
Pbjvision
📸 iOS Media Capture – features touch-to-record video, slow motion, and photography
Stars: ✭ 1,940 (+3.25%)
Mutual labels:  snapchat, camera, avfoundation
Nextlevel
NextLevel was initally a weekend project that has now grown into a open community of camera platform enthusists. The software provides foundational components for managing media recording, camera interface customization, gestural interaction customization, and image streaming on iOS. The same capabilities can also be found in apps such as Snapchat, Instagram, and Vine.
Stars: ✭ 1,940 (+3.25%)
Mutual labels:  snapchat, camera, avfoundation
MCamera
CameraViewController which allows to take photos, set filters, peform image blurring and more.
Stars: ✭ 28 (-98.51%)
Mutual labels:  photos, camera, avfoundation
Rxpaparazzo
RxJava extension for Android to take images using camera and gallery and pick files up
Stars: ✭ 467 (-75.15%)
Mutual labels:  camera, photos
Paparazzo
Custom iOS camera and photo picker with editing capabilities
Stars: ✭ 714 (-62%)
Mutual labels:  camera, photos
Pictureselectorlight
Picture Selector Library for Android or 图片选择器
Stars: ✭ 145 (-92.28%)
Mutual labels:  camera, photos
React Native Vision Camera
📸 The Camera library that sees the vision.
Stars: ✭ 443 (-76.42%)
Mutual labels:  snapchat, camera
Stickercamera
This is an Android application with camera,picture cropping,collage sticking and tagging.贴纸标签相机,功能:拍照,相片裁剪,给图片贴贴纸,打标签。
Stars: ✭ 3,109 (+65.46%)
Mutual labels:  camera, photos
Snapchat Clone
👻 A SnapChat clone built with React, Redux and Typescript. Styled with SASS. Tested with Cypress, Jest and Enzyme. Linted with Eslint and formatted with Prettier!
Stars: ✭ 770 (-59.02%)
Mutual labels:  snapchat, camera
Media picker
A Flutter Plugin for Selecting and Taking New Photos and Videos.
Stars: ✭ 24 (-98.72%)
Mutual labels:  camera, photos
Magicalcamera
A library to take picture easy, transform your data in different format and save photos in your device
Stars: ✭ 327 (-82.6%)
Mutual labels:  camera, photos
Livephoto
A single-file library for working with Apple Live Photos
Stars: ✭ 75 (-96.01%)
Mutual labels:  photos, avfoundation
Cameramanager
Simple Swift class to provide all the configurations you need to create custom camera view in your app
Stars: ✭ 1,130 (-39.86%)
Mutual labels:  camera, video-recording
Spectaculum
A spectacular view widget for visual media content on Android
Stars: ✭ 78 (-95.85%)
Mutual labels:  camera, photos
Fullscreencamera
A Full Screen Camera App written in Swift
Stars: ✭ 131 (-93.03%)
Mutual labels:  camera, avfoundation

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"

Carthage

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]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].