Code Monkey home page Code Monkey logo

iqaudiorecordercontroller's Introduction

Icon

IQAudioRecorderController

IQAudioRecorderController is a drop-in universal library allows to record and crop audio within the app with a nice User Interface. There are also optional callback delegate methods to return recorded file path.

Idle Recording Playing No Access

Installation

CocoaPods

You can use CocoaPods to install IQAudioRecorderController by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'IQAudioRecorderController'

To get the full benefits import IQAudioRecorderController wherever you import UIKit

import UIKit
import IQAudioRecorderController

Manually

  1. Download and drop /IQAudioRecorderControllerfolder in your project.
  2. Congratulations!

Supported format

Currently IQAudioRecorderController library only support .m4a file format.

Customization

There are optional properties to customize the appearance according to your app theme.

barStyle: UIBarStyle: Library support light and dark style UI for user interface. If you would like to present light style UI then you need to set barStyle to UIBarStyleDefault, otherwise dark style UI is the default.

normalTintColor: UIColor: This tintColor is used for showing wave tintColor while not recording, it is also used for top navigationBar and bottom toolbar tintColor.

highlightedTintColor: UIColor: Highlighted tintColor is used when playing recorded audio file or when recording audio file.

How to use

There are two seprate classes to Record and Crop Audio files.

To Record audio file, try something like this:-

#import "IQAudioRecorderViewController.h"

@interface ViewController ()<IQAudioRecorderViewControllerDelegate>
@end

@implementation ViewController

- (void)recordAction:(id)sender {
    IQAudioRecorderViewController *controller = [[IQAudioRecorderViewController alloc] init];
    controller.delegate = self;
    controller.title = "Recorder";
    controller.maximumRecordDuration = 10;
    controller.allowCropping = YES;
//    controller.barStyle = UIBarStyleDefault;
//    controller.normalTintColor = [UIColor magentaColor];
//    controller.highlightedTintColor = [UIColor orangeColor];
    [self presentBlurredAudioRecorderViewControllerAnimated:controller];
}

-(void)audioRecorderController:(IQAudioRecorderViewController *)controller didFinishWithAudioAtPath:(NSString *)filePath {
    //Do your custom work with file at filePath.
    [controller dismissViewControllerAnimated:YES completion:nil];
}

-(void)audioRecorderControllerDidCancel:(IQAudioRecorderViewController *)controller {
    //Notifying that user has clicked cancel.
    [controller dismissViewControllerAnimated:YES completion:nil];
}

@end

To Crop audio file, try something like this:-

#import "IQAudioCropperViewController.h"

@interface ViewController ()<IQAudioCropperViewControllerDelegate>
@end

@implementation ViewController

-(void)cropAction:(id)item {
    IQAudioCropperViewController *controller = [[IQAudioCropperViewController alloc] initWithFilePath:filePath];
    controller.delegate = self;
    controller.title = "Edit";
//    controller.barStyle = UIBarStyleDefault;
//    controller.normalTintColor = [UIColor magentaColor];
//    controller.highlightedTintColor = [UIColor orangeColor];
    [self presentBlurredAudioCropperViewControllerAnimated:controller];
}

-(void)audioCropperController:(IQAudioCropperViewController *)controller didFinishWithAudioAtPath:(NSString *)filePath {
    //Do your custom work with file at filePath.
    [controller dismissViewControllerAnimated:YES completion:nil];
}

-(void)audioCropperControllerDidCancel:(IQAudioCropperViewController *)controller {
    //Notifying that user has clicked cancel.
    [controller dismissViewControllerAnimated:YES completion:nil];
}

@end

Attributions

Thanks to Stefan Ceriu for his brilliant SCSiriWaveformView library.

Thanks to William Entriken for his FDWaveformView library.

LICENSE

Distributed under the MIT license. See LICENSE for more information.

Contributions

Any contribution is more than welcome! You can contribute through pull requests and issues on GitHub.

Author

If you wish to contact me, email at: [email protected]

iqaudiorecordercontroller's People

Contributors

hackiftekhar avatar jeffreyjackson avatar alexandrterentyev avatar lfarah avatar muhaos avatar hqlulu avatar

Watchers

James Cloos avatar Surya Narayan Barik avatar

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.