<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPlayer/setDisconnectedFromSystemAudio(_:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "s:So8AVPlayerC12AVFoundationE30setDisconnectedFromSystemAudio_17completionHandlerySb_yyYbcSgtF"
  },
  "title" : "setDisconnectedFromSystemAudio(_:completionHandler:)"
}
-->

# setDisconnectedFromSystemAudio(_:completionHandler:)

Changes whether the player is disconnected from system audio.
This method allows you to dynamically change the player’s system audio connection.
The operation is asynchronous. Each call to this method will invoke its own completion handler when the operation completes.
When changing from `false` to `true`, you should typically call this method first, then deactivate the `AVAudioSession` to allow other audio to resume.

```
nonisolated func setDisconnectedFromSystemAudio(_ disconnected: Bool, completionHandler: (@Sendable () -> Void)? = nil)
```

## Parameters

`disconnected`

`true` to disconnect from system audio, `false` to connect to it.

`completionHandler`

A block that is called when the connection state change is complete. This block is called on an arbitrary queue. Defaults to `nil`.

## Using the completion handler

In a scenario where changing the value from `false` to `true` should also allow other system audio to resume, you should only deactivate the audio session once the player has disconnected from system audio.

```swift
// Disconnect from system audio and let other audio resume
player.setDisconnectedFromSystemAudio(true) {
	try AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)