Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 1.05 KB

README.md

File metadata and controls

40 lines (27 loc) · 1.05 KB

OpusRecorder

Record microphone input and encode data with opus codec.

Example

// Create a file to store voice recording
let audioFilename = ProcessInfo.processInfo.globallyUniqueString + ".ogg"
let audioFilePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(audioFilename)
let audioURL = URL(fileURLWithPath: audioFilePath, isDirectory: false)

if !FileManager.default.fileExists(atPath: audioFile.path) {
	FileManager.default.createFile(atPath: audioFile.path, contents: nil, attributes: nil)
}

// Start recording
let recorder = OpusRecorder()
recorder.start(audioURL!) { (error: Error) in
	print("Failed to start recording, error: \(error)")
}

// Stop recording
recorder.stop()

Installation

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

pod "OpusRecorder"

Author

obaskanderi, [email protected]

License

OpusRecorder is available under the Apache 2.0 license. See the LICENSE file for more info.