Düzenle

Aracılığıyla paylaş


AVAudioSession.SetCategory Method

Definition

Overloads

SetCategory(String, String, AVAudioSessionCategoryOptions, NSError)
SetCategory(String, AVAudioSessionCategoryOptions, NSError)

Weakly typed; Requests a change to the Category.

SetCategory(NSString, NSError)

Weakly typed; Requests a change to the Category.

SetCategory(String, String, AVAudioSessionRouteSharingPolicy, AVAudioSessionCategoryOptions, NSError)
SetCategory(NSString)

Weakly typed; Requests a change to the Category.

SetCategory(AVAudioSessionCategory)

Requests a change to the Category.

SetCategory(AVAudioSessionCategory, AVAudioSessionCategoryOptions)

Requests a change to the Category.

SetCategory(String, String, AVAudioSessionCategoryOptions, NSError)

[Foundation.Export("setCategory:mode:options:error:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 3, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual bool SetCategory (string category, string mode, AVFoundation.AVAudioSessionCategoryOptions options, out Foundation.NSError outError);
abstract member SetCategory : string * string * AVFoundation.AVAudioSessionCategoryOptions *  -> bool
override this.SetCategory : string * string * AVFoundation.AVAudioSessionCategoryOptions *  -> bool

Parameters

category
String
mode
String
outError
NSError

Returns

Attributes

Applies to

SetCategory(String, AVAudioSessionCategoryOptions, NSError)

Weakly typed; Requests a change to the Category.

[Foundation.Export("setCategory:withOptions:error:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual bool SetCategory (string category, AVFoundation.AVAudioSessionCategoryOptions options, out Foundation.NSError outError);
abstract member SetCategory : string * AVFoundation.AVAudioSessionCategoryOptions *  -> bool
override this.SetCategory : string * AVFoundation.AVAudioSessionCategoryOptions *  -> bool

Parameters

options
AVAudioSessionCategoryOptions

Options on how to handle audio.

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

In general, you should set the category before activating your audio session with SetActive(Boolean, AVAudioSessionSetActiveOptions, NSError). If you change the category at runtime, the route will change.

Applies to

SetCategory(NSString, NSError)

Weakly typed; Requests a change to the Category.

[Foundation.Export("setCategory:error:")]
public virtual bool SetCategory (Foundation.NSString theCategory, out Foundation.NSError outError);
abstract member SetCategory : Foundation.NSString *  -> bool
override this.SetCategory : Foundation.NSString *  -> bool

Parameters

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

In general, you should set the category before activating your audio session with SetActive(Boolean, AVAudioSessionSetActiveOptions, NSError). If you change the category at runtime, the route will change.

Applies to

SetCategory(String, String, AVAudioSessionRouteSharingPolicy, AVAudioSessionCategoryOptions, NSError)

[Foundation.Export("setCategory:mode:routeSharingPolicy:options:error:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 5, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.MacOSX, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual bool SetCategory (string category, string mode, AVFoundation.AVAudioSessionRouteSharingPolicy policy, AVFoundation.AVAudioSessionCategoryOptions options, out Foundation.NSError outError);
abstract member SetCategory : string * string * AVFoundation.AVAudioSessionRouteSharingPolicy * AVFoundation.AVAudioSessionCategoryOptions *  -> bool
override this.SetCategory : string * string * AVFoundation.AVAudioSessionRouteSharingPolicy * AVFoundation.AVAudioSessionCategoryOptions *  -> bool

Parameters

category
String
mode
String
outError
NSError

To be added.

This parameter can be null.

Returns

Attributes

Applies to

SetCategory(NSString)

Weakly typed; Requests a change to the Category.

public Foundation.NSError SetCategory (Foundation.NSString theCategory);
member this.SetCategory : Foundation.NSString -> Foundation.NSError

Parameters

Returns

null on success, or an instance of NSError in case of failure with the details about the error.

Remarks

In general, you should set the category before activating your audio session with SetActive(Boolean, AVAudioSessionSetActiveOptions, NSError). If you change the category at runtime, the route will change.

Applies to

SetCategory(AVAudioSessionCategory)

Requests a change to the Category.

public Foundation.NSError SetCategory (AVFoundation.AVAudioSessionCategory category);
member this.SetCategory : AVFoundation.AVAudioSessionCategory -> Foundation.NSError

Parameters

category
AVAudioSessionCategory

The desired category.

Returns

null on success, or an instance of NSError in case of failure with the details about the error.

Remarks

In general, you should set the category before activating your audio session with SetActive(Boolean, AVAudioSessionSetActiveOptions, NSError). If you change the category at runtime, the route will change.

Applies to

SetCategory(AVAudioSessionCategory, AVAudioSessionCategoryOptions)

Requests a change to the Category.

public Foundation.NSError SetCategory (AVFoundation.AVAudioSessionCategory category, AVFoundation.AVAudioSessionCategoryOptions options);
member this.SetCategory : AVFoundation.AVAudioSessionCategory * AVFoundation.AVAudioSessionCategoryOptions -> Foundation.NSError

Parameters

category
AVAudioSessionCategory

The desired category.

options
AVAudioSessionCategoryOptions

Options on how to handle audio.

Returns

null on success, or an instance of NSError in case of failure with the details about the error.

Remarks

In general, you should set the category before activating your audio session with SetActive(Boolean, AVAudioSessionSetActiveOptions, NSError). If you change the category at runtime, the route will change.

Applies to