Share via


AVAudioSession.SetActive Method

Definition

Overloads

Name Description
SetActive(Boolean)

Activates or deactivates the audio session for the application.

SetActive(Boolean, AVAudioSessionSetActiveOptions)

Activates and deactivates the audio session for the application.

SetActive(Boolean, NSError)

Activates or deactivates the audio session for the application.

SetActive(Boolean, AVAudioSessionSetActiveOptions, NSError)

Activates and deactivates the audio session for the application.

SetActive(Boolean)

Activates or deactivates the audio session for the application.

[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
public Foundation.NSError? SetActive(bool beActive);
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
member this.SetActive : bool -> Foundation.NSError

Parameters

beActive
Boolean

Set to true to activate audio, false to deactivate it.

Returns

null on success, or an instance of NSError on failure.

Attributes

Remarks

Audio activation can fail if an application with a higher audio priority than yours is currently running.

Audio deactivation can fail if there are running audio operations in progress (playback, recording, audio queues or conversions).

Applies to

SetActive(Boolean, AVAudioSessionSetActiveOptions)

Activates and deactivates the audio session for the application.

[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
public Foundation.NSError? SetActive(bool active, AVFoundation.AVAudioSessionSetActiveOptions options);
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
member this.SetActive : bool * AVFoundation.AVAudioSessionSetActiveOptions -> Foundation.NSError

Parameters

active
Boolean

Set to true to activate audio, false to deactivate it.

options
AVAudioSessionSetActiveOptions

Options to control the audio activation.

Returns

null on success, or an instance of NSError on failure.

Attributes

Remarks

Audio activation can fail if an application with a higher audio priority than yours is currently running.

Audio deactivation can fail if there are running audio operations in progress (playback, recording, audio queues or conversions).

Applies to

SetActive(Boolean, NSError)

Activates or deactivates the audio session for the application.

[Foundation.Export("setActive:error:")]
[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
public virtual bool SetActive(bool beActive, out Foundation.NSError outError);
[<Foundation.Export("setActive:error:")>]
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
abstract member SetActive : bool * NSError -> bool
override this.SetActive : bool * NSError -> bool

Parameters

beActive
Boolean

Set to true to activate audio, false to deactivate it.

outError
NSError

On failure, this contains the error details.

Returns

true on success, false on error. If there is an error the outError parameter contains the new instance of NSError describing the problem.

Attributes

Remarks

Audio activation can fail if an application with a higher audio priority than yours is currently running.

Audio deactivation can fail if there are running audio operations in progress (playback, recording, audio queues or conversions).

Applies to

SetActive(Boolean, AVAudioSessionSetActiveOptions, NSError)

Activates and deactivates the audio session for the application.

[Foundation.Export("setActive:withOptions:error:")]
[ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)]
public virtual bool SetActive(bool active, AVFoundation.AVAudioSessionSetActiveOptions options, out Foundation.NSError outError);
[<Foundation.Export("setActive:withOptions:error:")>]
[<ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)>]
abstract member SetActive : bool * AVFoundation.AVAudioSessionSetActiveOptions * NSError -> bool
override this.SetActive : bool * AVFoundation.AVAudioSessionSetActiveOptions * NSError -> bool

Parameters

active
Boolean

Set to true to activate audio, false to deactivate it.

options
AVAudioSessionSetActiveOptions

Options to control the audio activation.

outError
NSError

On failure, this contains the error details.

Returns

true if the request was successful, otherwise the outError parameter contains an instance of NSError describing the problem.

Attributes

Remarks

Audio activation can fail if an application with a higher audio priority than yours is currently running.

Audio deactivation can fail if there are running audio operations in progress (playback, recording, audio queues or conversions).

Applies to