AWSLexAudioPlayer

Objective-C

@interface AWSLexAudioPlayer : NSObject

Swift

class AWSLexAudioPlayer : NSObject

Wrapper to AVAudioPLayer class.

  • Set it to handle error.

    Declaration

    Objective-C

    @property (nonatomic) void (^_Nonnull) (NSError *_Nonnull) errorBlock;

    Swift

    var errorBlock: (Error) -> Void { get set }
  • Set it to handle successful audio play.

    Declaration

    Objective-C

    @property (nonatomic) void (^_Nonnull) (void) completionBlock;

    Swift

    var completionBlock: () -> Void { get set }
  • Set it to handle when audio has been prepared to play.

    Declaration

    Objective-C

    @property (nonatomic) void (^_Nonnull) (void) preparedBlock;

    Swift

    var preparedBlock: () -> Void { get set }
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithData:(NSData *)audioData;

    Swift

    init(data audioData: Data)
  • Start playing sound.

    When audio is prepared to play, preparedBlock will get called if it is set. Once audio is successfully played audio, completionBlock will get called if it is set. Otherwise errorBlock is get called.

    Declaration

    Objective-C

    - (void)start;

    Swift

    func start()