Szerkesztés

Megosztás a következőn keresztül:


AudioSession.Initialize Method

Definition

Overloads

Initialize()

Initializes the Audio Session.

Initialize(CFRunLoop, String)

Initializes the Audio Session.

Initialize()

Initializes the Audio Session.

[ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 7, 0, ObjCRuntime.PlatformArchitecture.None, null)]
public static void Initialize ();
static member Initialize : unit -> unit
Attributes

Remarks

In addition to calling the Initialize method on AudioSession, you will want to set the Category and the Mode properties to control the priority of your audio and the rules for mixing your audio with other audio playing on the device.

When you call this variation of Initialize, both the Interrupted and Resumed events are raised on the main loop. Use the Initialize(CFRunLoop, String) if you want to specify a different runloop.

If there is an error initializing the AudioSession, this will raise an AudioSessionException.

//
// Initialize the audio session for audio playback
//
AudioSession.Initialize ();
AudioSession.Category = AudioSessionCategory.MediaPlayback;

Applies to

Initialize(CFRunLoop, String)

Initializes the Audio Session.

public static void Initialize (CoreFoundation.CFRunLoop runLoop, string runMode);
static member Initialize : CoreFoundation.CFRunLoop * string -> unit

Parameters

runLoop
CFRunLoop

The runloop to execute on.

runMode
String

Run loop mode (see T:Foundation.CFRunLoop for the various modes).

Remarks

In addition to calling the Initialize method on AudioSession, you will want to set the Category and the Mode properties to control the priority of your audio and the rules for mixing your audio with other audio playing on the device.

When you call this variation of Initialize, both the Interrupted and Resumed events are raised on the specified run loop with the specified run loop mode. Use the Initialize() if you want those events to be raised on the main thread.

var myRunLoop = CFRunLoop.Current;
var myRunMode = CFRunLoop.CFDefaultRunLoopMode;
//
// Initialize the audio session for audio playback
//
AudioSession.Initialize (myRunLoop, myRunMode);
AudioSession.Category = AudioSessionCategory.MediaPlayback;

Applies to