ORKAudioRecorder Class Reference

Inherits from ORKRecorder : NSObject
Declared in ORKAudioRecorder.h
ORKAudioRecorder.m

Overview

The ORKAudioRecorder class represents a recorder that uses the app’s AVAudioSession object to record audio.

To ensure audio recording continues when a task enters the background, add the audio tag to UIBackgroundModes in your app’s Info.plist file.

Other Methods

+ defaultRecorderSettings

The default audio format settings.

+ (NSDictionary *)defaultRecorderSettings

Discussion

If no settings are specified, the audio configuration is MPEG4 AAC, 2 channels, 16 bit, 44.1 kHz, AVAudioQualityMin.

Declared In

ORKAudioRecorder.h

– initWithIdentifier:recorderSettings:step:outputDirectory:

Returns an initialized audio recorder using the specified settings, step, and output directory.

- (instancetype)initWithIdentifier:(NSString *)identifier recorderSettings:(NSDictionary *)recorderSettings step:(ORKStep *)step outputDirectory:(NSURL *)outputDirectory

Parameters

identifier

The unique identifier of the recorder (assigned by the recorder configuration).

recorderSettings

The settings for the recording session.

step

The step that requested this recorder.

outputDirectory

The directory in which the audio output should be stored.

Return Value

An initialized audio recorder.

Declared In

ORKAudioRecorder.h

– start

Starts data recording.

- (void)start

Discussion

If an error occurs when recording starts, it is returned through the delegate.

Declared In

ORKRecorder.h

– stop

Stops data recording, which generally triggers the return of results.

- (void)stop

Discussion

If an error occurs when stopping the recorder, it is returned through the delegate. Subclasses should call finishRecordingWithError: rather than calling super.

Declared In

ORKRecorder.h

– isRecording

A Boolean value indicating whether the recorder is currently recording.

- (BOOL)isRecording

Return Value

YES if the recorder is recording; otherwise, NO.

Declared In

ORKRecorder.h

– finishRecordingWithError:

Indicates that recording has failed; stop recording and report the error to the delegate

- (void)finishRecordingWithError:(NSError *)error

Parameters

error

Error that occurred.

Declared In

ORKRecorder_Private.h

Other Methods

  recorderSettings

Audio format settings

@property (nonatomic, copy, readonly) NSDictionary *recorderSettings

Discussion

Settings for the recording session. Passed to AVAudioRecorder's-initWithURL:settings:error:` For information on the settings available for an audio recorder, see “AV Foundation Audio Settings Constants”.

Declared In

ORKAudioRecorder.h

  audioRecorder

Reference to the audio recorder being used.

@property (nonatomic, strong, readonly, nullable) AVAudioRecorder *audioRecorder

Discussion

The value of this property is used in the audio task in order to display recorded volume in real time during the task.

Declared In

ORKAudioRecorder.h