Instance Method

setActive:withFlags:error:

Activates or deactivates your app’s audio session; provides flags for use by other audio sessions.

Declaration

- (BOOL)setActive:(BOOL)active withFlags:(NSInteger)flags error:(NSError * _Nullable *)outError;

Parameters

active

Use YES to activate your app’s audio session or NO to deactivate it.

flags

A bitmapped value containing one or more flags from the Activation Flags enumeration.

outError

On input, a pointer to an error object. If an error occurs, the pointer is set to an NSError object that describes the error. If you do not want error information, pass in nil.

Return Value

Returns YES on success or NO on failure.

Discussion

If another app’s active audio session has higher priority than your app, and that other audio session does not allow mixing with other apps, attempting to activate your audio session might fail.

See Also

Deprecations

- init

Gets a reference to the singleton audio session.

Deprecated
delegate

The delegate object for the audio session.

Deprecated
inputIsAvailable

A Boolean value that indicates whether a hardware audio input path is available (YES), or not (NO).

Deprecated
currentHardwareInputNumberOfChannels

The number of audio hardware input channels.

Deprecated
currentHardwareOutputNumberOfChannels

The number of audio hardware output channels.

Deprecated
currentHardwareSampleRate

The audio hardware sample rate, in hertz.

Deprecated
preferredHardwareSampleRate

The preferred hardware sample rate, in hertz.

Deprecated
- setPreferredHardwareSampleRate:error:

Sets the preferred hardware sample rate for input and output.

Deprecated