ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๋ชฉ๋ก

  1. ์ฝ”๋“œ

AudioEngine setCategory, setMode - ์˜ค๋””์˜ค ์—”์ง„ ์…‹์—…

  1. ์ฝ”๋“œ ์†์„ฑ๊ฐ’

AVAudioSession.Category - ์ž…์ถœ๋ ฅ์ œ์–ด

AVAudioSession.CategoryOptions - ๊ถŒํ•œ์—ฌ๋ถ€

AVAudioSession.Mode - ์ž…๋ ฅ ๋ชจ๋“œ์˜ ์ข…๋ฅ˜, ์ถœ๋ ฅ ๋ชจ๋“œ์˜ ์ข…๋ฅ˜

AVAudioSession.Port - ์ž…์ถœ๋ ฅ ์žฅ์น˜

 

 

์˜ค๋””์˜ค ์…‹์—… ์ฝ”๋“œ

  • Audio Engine setCategory, setMode - ์˜ค๋””์˜ค ์—”์ง„ ์…‹์—…
let audioSession = AVAudioSession.sharedInstance()
do {
      try audioSession.setCategory(.playAndRecord, options: .allowBluetooth)
			try audioSession.setMode(.default)
			try audioSession.setActive(true, options: .notifyOthersOnDeactivation)
} catch {
			debugPrint("๐Ÿ”ดaudioSession properties weren't set because of an error.")
}

 

setCategory ์†์„ฑ๊ฐ’

  • AVAudioSession.Category - ์ž…์ถœ๋ ฅ์ œ์–ด
    1. ์ถœ๋ ฅ๋งŒ ํ• ๊ฑด์ง€
    2. ์ž…๋ ฅ๋งŒ ํ• ๊ฑด์ง€
    3. ์ž…์ถœ๋ ฅ ํ• ๊ฑด์ง€
extension AVAudioSession.Category {

    /** Use this category for background sounds such as rain, car engine noise, etc.
     Mixes with other music. */
    @available(iOS 3.0, *)
    public static let ambient: AVAudioSession.Category

    /** Use this category for background sounds.  Other music will stop playing. */
    @available(iOS 3.0, *)
    public static let soloAmbient: AVAudioSession.Category

    /** Use this category for music tracks.*/
    @available(iOS 3.0, *)
    public static let playback: AVAudioSession.Category

    /** Use this category when recording audio. */
    @available(iOS 3.0, *)
    public static let record: AVAudioSession.Category

    /** Use this category when recording and playing back audio. */
    @available(iOS 3.0, *)
    public static let playAndRecord: AVAudioSession.Category

    /** Use this category when using a hardware codec or signal processor while
     not playing or recording audio. */
    @available(iOS, introduced: 3.0, deprecated: 10.0, message: "No longer supported")
    public static let audioProcessing: AVAudioSession.Category

    /** Use this category to customize the usage of available audio accessories and built-in audio hardware.
     For example, this category provides an application with the ability to use an available USB output
     and headphone output simultaneously for separate, distinct streams of audio data. Use of
     this category by an application requires a more detailed knowledge of, and interaction with,
     the capabilities of the available audio routes.  May be used for input, output, or both.
     Note that not all output types and output combinations are eligible for multi-route.  Input is limited
     to the last-in input port. Eligible inputs consist of the following:
     AVAudioSessionPortUSBAudio, AVAudioSessionPortHeadsetMic, and AVAudioSessionPortBuiltInMic.
     Eligible outputs consist of the following:
     AVAudioSessionPortUSBAudio, AVAudioSessionPortLineOut, AVAudioSessionPortHeadphones, AVAudioSessionPortHDMI,
     and AVAudioSessionPortBuiltInSpeaker.
     Note that AVAudioSessionPortBuiltInSpeaker is only allowed to be used when there are no other eligible
     outputs connected.  */
    @available(iOS 6.0, *)
    public static let multiRoute: AVAudioSession.Category
}

  • AVAudioSession.CategoryOptions - ๊ถŒํ•œ์—ฌ๋ถ€

https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions

  1. ๋ธ”๋ฃจํˆฌ์Šค ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ• ๊ฑด์ง€ - ์‚ฌ์šฉ์ค‘ allowBluetooth
  2. AirPlay ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ• ๊ฑด์ง€
  3. ๋‹ค๋ฅธ ์ œ์–ด๊ฐ€ ๋“ค์–ด์˜ค๋ฉด Mute ํ• ๊ฑด์ง€
public struct CategoryOptions : OptionSet, @unchecked Sendable {

        public init(rawValue: UInt)

        
        public static var mixWithOthers: AVAudioSession.CategoryOptions { get }

        public static var duckOthers: AVAudioSession.CategoryOptions { get }

        public static var allowBluetooth: AVAudioSession.CategoryOptions { get }

        public static var defaultToSpeaker: AVAudioSession.CategoryOptions { get }

        @available(iOS 9.0, *)
        public static var interruptSpokenAudioAndMixWithOthers: AVAudioSession.CategoryOptions { get }

        @available(iOS 10.0, *)
        public static var allowBluetoothA2DP: AVAudioSession.CategoryOptions { get }

        @available(iOS 10.0, *)
        public static var allowAirPlay: AVAudioSession.CategoryOptions { get }

        @available(iOS 14.5, *)
        public static var overrideMutedMicrophoneInterruption: AVAudioSession.CategoryOptions { get }
    }

<aside> ๐Ÿ’ก ์˜ต์…˜

  • mixWithOthers: ๋‹ค๋ฅธ ์•ฑ์˜ ์†Œ๋ฆฌ์™€ ์šฐ๋ฆฌ ์•ฑ ์†Œ๋ฆฌ๊ฐ€ ํ•จ๊ป˜ ๋“ค๋ฆด ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๋Š” ์˜ต์…˜.
  • duckOthers: mixWithOthers ๋ฅผ ๊ธฐ๋ณธ์œผ๋กœ ์ฑ„ํƒํ•˜๋ฉด์„œ +์šฐ๋ฆฌ ์•ฑ์—์„œ ์†Œ๋ฆฌ๊ฐ€ ๋‚  ๋•Œ๋Š” ๋‹ค๋ฅธ ์•ฑ ์†Œ๋ฆฌ๋ฅผ ์‚ด์ง ์ฃฝ์ด๋Š” ์˜ต์…˜.
  • interruptSpokenAudioAndMixWithOthers: mixWithOthers๋ฅผ ๊ธฐ๋ณธ์œผ๋กœ ์ฑ„ํƒํ•˜๋ฉด์„œ + ๋‹ค๋ฅธ ์•ฑ์—์„œ spokenAudio ๊ฐ€ ์ถœ๋ ฅ๋  ๋•Œ์—๋งŒ interrupt ๊ฑธ๊ณ  ์šฐ๋ฆฌ ์•ฑ์ด ์†Œ๋ฆฌ๋ฅผ ๋…์ฐจ์ง€ (*๋ผ๋””์˜ค, ํŒŸ์บ์ŠคํŠธ ๋“ฑ์„ ์ƒ๊ฐํ•˜๋ฉด ๋จ)
    • <์ฐธ๊ณ > duckOthers์™€ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉด ๋‹ค๋ฅธ ์•ฑ์—์„œ Media ์ข…๋ฅ˜์˜ Audio ๋ฅผ ์žฌ์ƒํ• ๋•Œ๋Š” duckOthers ์˜ ์„ค์ •์„ ๋”ฐ๋ฅด๊ณ , ๋‹ค๋ฅธ ์•ฑ์—์„œ spokenAudio๊ฐ€ ์ถœ๋ ฅ๋˜๊ณ  ์žˆ์„ ๋•Œ์—๋งŒ ์šฐ๋ฆฌ ์•ฑ์ด interrupt ๋ฅผ ๊ฑธ์–ด๋ฒ„๋ฆฐ๋‹ค
  • allowBluetoothA2DP: ๋ธ”๋ฃจํˆฌ์Šค ๋””๋ฐ”์ด์Šค ์ง€์›์„ ์œ„ํ•œ ์˜ต์…˜
    • playback ์นดํ…Œ๊ณ ๋ฆฌ์—์„œ๋Š” ๊ธฐ๋ณธ์ œ๊ณต์ด์ง€๋งŒ playAndRecord ์นดํ…Œ๊ณ ๋ฆฌ์—์„œ๋Š” ๊ธฐ๋ณธ์ด ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์— ๋”ฐ๋กœ ์…‹ํŒ…ํ•ด์ฃผ์–ด์•ผ ํ•จ
  • defaultToSpeaker: ์—ฐ๊ฒฐ๋œ ์˜ค๋””์˜ค receiver๊ฐ€ ๋”ฐ๋กœ ์žˆ์„๋•Œ(ex: ์•„์ดํฐ built-in receiver, ์ด์–ดํฐ, ์นด์˜ค๋””์˜ค ๋“ฑ), ๊ทธ์ชฝ์ด ์•„๋‹Œ ํฐ speaker๋กœ ์˜ค๋””์˜ค๋ฅผ ์ „๋‹ฌํ•˜๊ฒŒ ํ•ด์ฃผ๋Š” ์˜ต์…˜
    • playAndRecord ์นดํ…Œ๊ณ ๋ฆฌ์—์„œ๋งŒ ์œ ํšจํ•œ ์˜ต์…˜
    • ์ด ์˜ต์…˜๊ณผ ๊ฐ™์€ ์—ญํ• ์„ ํ•˜๋Š” AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker) ๋ผ๋Š” ์ผํšŒ์„ฑ ํ•จ์ˆ˜๋„ ์žˆ๋‹ค

์ถ”๊ฐ€์ ์œผ๋กœ

  • duck/interrupt ์˜ต์…˜์„ ์‚ฌ์šฉํ–ˆ๋‹ค๋ฉด ์˜ค๋””์˜ค๊ฐ€ ์ข…๋ฃŒ๋  ๋•Œ deactive(with notifyOthersOnDeactivation option)๋ฅผ ํ†ตํ•ด ์™ธ๋ถ€ ์•ฑ๋“ค์ด ๋‹ค์‹œ ์˜ค๋””์˜ค ์„ธ์…˜์„ ์ฐจ์ง€ํ•  ์ˆ˜ ์žˆ๋„๋ก ์•Œ๋ ค์ฃผ์–ด์•ผ ํ•œ๋‹ค </aside>
/**
        @enum        AVAudioSessionCategoryOptions
        @brief        Customization of various aspects of a category's behavior. Use with
                    setCategory:mode:options:error:.
    
        Applications must be prepared for changing category options to fail as behavior may change
        in future releases. If an application changes its category, it should reassert the options,
        since they are not sticky across category changes. Introduced in iOS 6.0 / watchOS 2.0 /
        tvOS 9.0.
    
        @var AVAudioSessionCategoryOptionMixWithOthers
            Controls whether other active audio apps will be interrupted or mixed with when your app's
            audio session goes active. Details depend on the category.
    
            AVAudioSessionCategoryPlayAndRecord or AVAudioSessionCategoryMultiRoute:
                 MixWithOthers defaults to false, but can be set to true, allowing other applications to
                 play in the background while your app has both audio input and output enabled.
    
            AVAudioSessionCategoryPlayback:
                 MixWithOthers defaults to false, but can be set to true, allowing other applications to
                 play in the background. Your app will still be able to play regardless of the setting
                 of the ringer switch.
    
            Other categories:
                 MixWithOthers defaults to false and cannot be changed.
    
            MixWithOthers is only valid with AVAudioSessionCategoryPlayAndRecord,
            AVAudioSessionCategoryPlayback, and AVAudioSessionCategoryMultiRoute.
    
        @var AVAudioSessionCategoryOptionDuckOthers
            Controls whether or not other active audio apps will be ducked when when your app's audio
            session goes active. An example of this is a workout app, which provides periodic updates to
            the user. It reduces the volume of any music currently being played while it provides its
            status.
    
            Defaults to off. Note that the other audio will be ducked for as long as the current session
            is active. You will need to deactivate your audio session when you want to restore full
            volume playback (un-duck) other sessions.
    
            Setting this option will also make your session mixable with others
            (AVAudioSessionCategoryOptionMixWithOthers will be set).
    
            DuckOthers is only valid with AVAudioSessionCategoryAmbient,
            AVAudioSessionCategoryPlayAndRecord, AVAudioSessionCategoryPlayback, and
            AVAudioSessionCategoryMultiRoute.
    
        @var AVAudioSessionCategoryOptionAllowBluetooth
            Allows an application to change the default behavior of some audio session categories with
            regard to whether Bluetooth Hands-Free Profile (HFP) devices are available for routing. The
            exact behavior depends on the category.
    
            AVAudioSessionCategoryPlayAndRecord:
                AllowBluetooth defaults to false, but can be set to true, allowing a paired bluetooth
                HFP device to appear as an available route for input, while playing through the
                category-appropriate output.
    
            AVAudioSessionCategoryRecord:
                AllowBluetooth defaults to false, but can be set to true, allowing a paired Bluetooth
                HFP device to appear as an available route for input
    
            Other categories:
                AllowBluetooth defaults to false and cannot be changed. Enabling Bluetooth for input in
                these categories is not allowed.
    
        @var AVAudioSessionCategoryOptionDefaultToSpeaker
            Allows an application to change the default behavior of some audio session categories with
            regard to the audio route. The exact behavior depends on the category.
    
            AVAudioSessionCategoryPlayAndRecord:
                DefaultToSpeaker will default to false, but can be set to true, routing to Speaker
                (instead of Receiver) when no other audio route is connected.
    
            Other categories:
                DefaultToSpeaker is always false and cannot be changed.
    
        @var AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers
            When a session with InterruptSpokenAudioAndMixWithOthers set goes active, then if there is
            another playing app whose session mode is AVAudioSessionModeSpokenAudio (for podcast
            playback in the background, for example), then the spoken-audio session will be
            interrupted. A good use of this is for a navigation app that provides prompts to its user:
            it pauses any spoken audio currently being played while it plays the prompt.
    
            InterruptSpokenAudioAndMixWithOthers defaults to off. Note that the other app's audio will
            be paused for as long as the current session is active. You will need to deactivate your
            audio session to allow the other session to resume playback. Setting this option will also
            make your category mixable with others (AVAudioSessionCategoryOptionMixWithOthers will be
            set). If you want other non-spoken audio apps to duck their audio when your app's session
            goes active, also set AVAudioSessionCategoryOptionDuckOthers.
    
            Only valid with AVAudioSessionCategoryPlayAndRecord, AVAudioSessionCategoryPlayback, and
            AVAudioSessionCategoryMultiRoute. Introduced in iOS 9.0 / watchOS 2.0 / tvOS 9.0.
    
        @var AVAudioSessionCategoryOptionAllowBluetoothA2DP
            Allows an application to change the default behavior of some audio session categories with
            regard to whether Bluetooth Advanced Audio Distribution Profile (A2DP) devices are
            available for routing. The exact behavior depends on the category.
    
            AVAudioSessionCategoryPlayAndRecord:
                AllowBluetoothA2DP defaults to false, but can be set to true, allowing a paired
                Bluetooth A2DP device to appear as an available route for output, while recording
                through the category-appropriate input.
    
            AVAudioSessionCategoryMultiRoute and AVAudioSessionCategoryRecord:
                AllowBluetoothA2DP is false, and cannot be set to true.
    
            Other categories:
                AllowBluetoothA2DP is always implicitly true and cannot be changed; Bluetooth A2DP ports
                are always supported in output-only categories.
    
            Setting both AVAudioSessionCategoryOptionAllowBluetooth and
            AVAudioSessionCategoryOptionAllowBluetoothA2DP is allowed. In cases where a single
            Bluetooth device supports both HFP and A2DP, the HFP ports will be given a higher priority
            for routing. For HFP and A2DP ports on separate hardware devices, the last-in wins rule
            applies.
    
            Introduced in iOS 10.0 / watchOS 3.0 / tvOS 10.0.
    
        @var AVAudioSessionCategoryOptionAllowAirPlay
            Allows an application to change the default behavior of some audio session categories with
            with regard to showing AirPlay devices as available routes. This option applies to
            various categories in the same way as AVAudioSessionCategoryOptionAllowBluetoothA2DP;
            see above for details.
    
            Only valid with AVAudioSessionCategoryPlayAndRecord. Introduced in iOS 10.0 / tvOS 10.0.
    
        @var AVAudioSessionCategoryOptionOverrideMutedMicrophoneInterruption
            Some devices include a privacy feature that mutes the built-in microphone at a hardware level
            under certain conditions e.g. when the Smart Folio of an iPad is closed. The default behavior is
            to interrupt the session using the built-in microphone when that microphone is muted in hardware.
            This option allows an application to opt out of the default behavior if it is using a category that
            supports both input and output, such as AVAudioSessionCategoryPlayAndRecord, and wants to
            allow its session to stay activated even when the microphone has been muted. The result would be
            that playback continues as normal, and microphone sample buffers would continue to be produced
            but all microphone samples would have a value of zero.
    
            This may be useful if an application knows that it wants to allow playback to continue and
            recording/monitoring a muted microphone will not lead to a poor user experience. Attempting to use
            this option with a session category that doesn't support the use of audio input will result in an error.
    
            Note that under the default policy, a session will be interrupted if it is running input at the time when
            the microphone is muted in hardware. Similarly, attempting to start input when the microphone is
            muted will fail.
            Note that this option has no relation to the recordPermission property, which indicates whether or
            not the user has granted permission to use microphone input.
    */

setMode ์†์„ฑ๊ฐ’

  • AVAudioSession.Mode - ์ž…๋ ฅ ๋ชจ๋“œ์˜ ์ข…๋ฅ˜, ์ถœ๋ ฅ ๋ชจ๋“œ์˜ ์ข…๋ฅ˜
    1. ๋””ํดํŠธ ๋ชจ๋“œ - ์‚ฌ์šฉ์ค‘
    2. ์ธก์ • ๋ชจ๋“œ
    3. ๋ณด์ด์Šค ์ฑ— ๋ชจ๋“œ
    4. ๊ฒŒ์ž„ ์ฑ— ๋ชจ๋“œ
    5. ์˜ํ™” ๋ชจ๋“œ
    6. ์Œ์„ฑ ๋ชจ๋“œ
    7. ๋Œ€ํ™”๋ชจ๋“œ
    8. ๋ณด์ด์Šค ํ”„๋กฌํ”„ํŠธ ๋ชจ๋“œ
extension AVAudioSession.Mode {

    /** The default mode */
    @available(iOS 5.0, *)
    public static let `default`: AVAudioSession.Mode

    /** Only valid with AVAudioSessionCategoryPlayAndRecord.  Appropriate for Voice over IP
     (VoIP) applications.  Reduces the number of allowable audio routes to be only those
     that are appropriate for VoIP applications and may engage appropriate system-supplied
     signal processing.  Has the side effect of setting AVAudioSessionCategoryOptionAllowBluetooth */
    @available(iOS 5.0, *)
    public static let voiceChat: AVAudioSession.Mode

    /** Set by Game Kit on behalf of an application that uses a GKVoiceChat object; valid
     only with the AVAudioSessionCategoryPlayAndRecord category.
     Do not set this mode directly. If you need similar behavior and are not using
     a GKVoiceChat object, use AVAudioSessionModeVoiceChat instead. */
    @available(iOS 5.0, *)
    public static let gameChat: AVAudioSession.Mode

    /** Only valid with AVAudioSessionCategoryPlayAndRecord or AVAudioSessionCategoryRecord.
     Modifies the audio routing options and may engage appropriate system-supplied signal processing. */
    @available(iOS 5.0, *)
    public static let videoRecording: AVAudioSession.Mode

    /** Appropriate for applications that wish to minimize the effect of system-supplied signal
     processing for input and/or output audio signals. */
    @available(iOS 5.0, *)
    public static let measurement: AVAudioSession.Mode

    /** Engages appropriate output signal processing for movie playback scenarios.  Currently
     only applied during playback over built-in speaker. */
    @available(iOS 6.0, *)
    public static let moviePlayback: AVAudioSession.Mode

    /** Only valid with kAudioSessionCategory_PlayAndRecord. Reduces the number of allowable audio
     routes to be only those that are appropriate for video chat applications. May engage appropriate
     system-supplied signal processing.  Has the side effect of setting
     AVAudioSessionCategoryOptionAllowBluetooth and AVAudioSessionCategoryOptionDefaultToSpeaker. */
    @available(iOS 7.0, *)
    public static let videoChat: AVAudioSession.Mode

    /** Appropriate for applications which play spoken audio and wish to be paused (via audio session interruption) rather than ducked
     if another app (such as a navigation app) plays a spoken audio prompt.  Examples of apps that would use this are podcast players and
     audio books.  For more information, see the related category option AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers. */
    @available(iOS 9.0, *)
    public static let spokenAudio: AVAudioSession.Mode

    /** Appropriate for applications which play audio using text to speech. Setting this mode allows for different routing behaviors when
     connected to certain audio devices such as CarPlay. An example of an app that would use this mode is a turn by turn navigation app that
     plays short prompts to the user. Typically, these same types of applications would also configure their session to use
     AVAudioSessionCategoryOptionDuckOthers and AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers */
    @available(iOS 12.0, *)
    public static let voicePrompt: AVAudioSession.Mode
}

๊ทธ ์™ธ

  • AVAudioSession.Port - ์ž…์ถœ๋ ฅ ์žฅ์น˜
    1. ์ž…๋ ฅ aux ์„ 
    2. ๋นŒํŠธ์ธ ๋งˆ์ดํฌ
    3. ํ—ค๋“œ์…‹ ๋งˆ์ดํฌ
    4. ์ถœ๋ ฅ aux ์„ 
    5. ํ—ค๋“œ์…‹ ์ถœ๋ ฅ
    6. ๋ธ”๋ฃจํˆฌ์Šค ์ž…์ถœ๋ ฅ
    7. ์ฌ๋”๋ณผํŠธ

์ด๋ ‡๊ฒŒ ๊นŒ์ง€ ์ง€์›ํ•œ๋‹ค๋Š” ๋œป ๋”ฐ๋กœ ์‚ฌ์šฉ์ค‘์ด์ง„ ์•Š์Œ.

extension AVAudioSession.Port {

    /// Line level input on a dock connector
    @available(iOS 6.0, *)
    public static let lineIn: AVAudioSession.Port

    /// Built-in microphone on an iOS device
    @available(iOS 6.0, *)
    public static let builtInMic: AVAudioSession.Port

    /// Microphone on a wired headset.  Headset refers to an accessory that has headphone outputs paired with a
    /// microphone.
    @available(iOS 6.0, *)
    public static let headsetMic: AVAudioSession.Port

    /// Line level output on a dock connector
    @available(iOS 6.0, *)
    public static let lineOut: AVAudioSession.Port

    /// Headphone or headset output
    @available(iOS 6.0, *)
    public static let headphones: AVAudioSession.Port

    /// Output on a Bluetooth A2DP device
    @available(iOS 6.0, *)
    public static let bluetoothA2DP: AVAudioSession.Port

    /// The speaker you hold to your ear when on a phone call
    @available(iOS 6.0, *)
    public static let builtInReceiver: AVAudioSession.Port

    /// Built-in speaker on an iOS device
    @available(iOS 6.0, *)
    public static let builtInSpeaker: AVAudioSession.Port

    /// Output via High-Definition Multimedia Interface
    @available(iOS 6.0, *)
    public static let HDMI: AVAudioSession.Port

    /// Output on a remote Air Play device
    @available(iOS 6.0, *)
    public static let airPlay: AVAudioSession.Port

    /// Output on a Bluetooth Low Energy device
    @available(iOS 7.0, *)
    public static let bluetoothLE: AVAudioSession.Port

    /// Input or output on a Bluetooth Hands-Free Profile device
    @available(iOS 6.0, *)
    public static let bluetoothHFP: AVAudioSession.Port

    /// Input or output on a Universal Serial Bus device
    @available(iOS 6.0, *)
    public static let usbAudio: AVAudioSession.Port

    /// Input or output via Car Audio
    @available(iOS 7.0, *)
    public static let carAudio: AVAudioSession.Port

    /// Input or output that does not correspond to real audio hardware
    @available(iOS 14.0, *)
    public static let virtual: AVAudioSession.Port

    /// Input or output connected via the PCI (Peripheral Component Interconnect) bus
    @available(iOS 14.0, *)
    public static let PCI: AVAudioSession.Port

    /// Input or output connected via FireWire
    @available(iOS 14.0, *)
    public static let fireWire: AVAudioSession.Port

    /// Input or output connected via DisplayPort
    @available(iOS 14.0, *)
    public static let displayPort: AVAudioSession.Port

    /// Input or output connected via AVB (Audio Video Bridging)
    @available(iOS 14.0, *)
    public static let AVB: AVAudioSession.Port

    /// Input or output connected via Thunderbolt
    @available(iOS 14.0, *)
    public static let thunderbolt: AVAudioSession.Port
}

์‚ฌ์šฉ์ค‘์ธ ์˜ต์…˜

  • ํ˜„์žฌ ์‚ฌ์šฉ์ค‘์ธ ์˜ต์…˜
try audioSession.setCategory(.playAndRecord, options: .allowBluetooth)
try audioSession.setMode(.default)

์ถ”๊ฐ€์ ์ธ ์ดํ•ด๊ฐ€ ํ•„์š”ํ•˜์‹œ๋‹ค๋ฉด ์ฐธ๊ณ ํ• ๋งŒํ•œ ๋ธ”๋กœ๊ทธ ๋งํฌ์ž…๋‹ˆ๋‹ค

https://wlaxhrl.tistory.com/92 ์ค‘๊ฐ„ Audio Session Setting ๋ถ€ํ„ฐ ๋ณด๋ฉด๋จ

๋Œ“๊ธ€