HPRecorder 1.0.1

HPRecorder 1.0.1

Maintained by Quang Hoang.



  • By
  • Hoang

HPRecorder

Platform Language Version License Issues Build codecov

A recorder audio for iOS, simple to integrate, calculated percent of loudness.

sample

Installation

CocoaPods

pod 'HPRecorder'

Manually

Copy the HPRecorder folder to your project.

Conguration

// Time interval to get percent of loudness
open var timeInterVal: TimeInterval = 0.3
// File name of audio
open var audioFilename: URL!
// Audio input: default speaker, bluetooth
open var audioInput: AVAudioSessionPortDescription!

Monitor recorder

// Recorder did finish
open var recorderDidFinish: ((_ recocorder: AVAudioRecorder, _ url: URL, _  success: Bool) -> Void)?
// Recorder occur error
open var recorderOccurError: ((_ recocorder: AVAudioRecorder, _ error: Error) -> Void)?
// Percent of loudness
open var percentLoudness: ((_ percent: Float) -> Void)?

Actions

// Ask permssion to record audio
public func askPermission(completion: ((_ allowed: Bool) -> Void)?)
// Start recording
public func startRecording()
// End recording
public func endRecording()
// Pause recorinding
public func pauseRecording()
// Resume recording
public func resumeRecording()

Usage

Setup

Add import HPRecorder in your file

In Info.plist file of project, you MUST add Privacy - Microphone Usage Description key to can use microphone permission.

Requirements

Swift 5.0

iOS 10.0+

Xcode 10.2+

Contributing

Forks, patches and other feedback are welcome.

Creator

Quang Hoang

Blog

License

HPRecorder is available under the MIT license. See the LICENSE file for more info.