Contents

activateDevice(_:session:for:)

Called when the user activates a device via a user interface.

Declaration

@MainActor func activateDevice(_ device: MediaOutputDevice, session: MediaOutputSession, for deviceFeatures: MediaOutputDevice.Capabilities)

Parameters

  • device:

    The device to activate.

  • session:

    The session associated with the activation.

  • deviceFeatures:

    The capabilities requested for this activation.

Mentioned in

Discussion

If the device requires additional user authentication, call requestPairingCode(for:session:reason:authorizationMethod:). The system will report user input via connectUsingPairingCode(_:to:session:).

If the authorization fails, or the connection to the device fails, call failedToActivateDevice(_:session:error:).

If the activation is successful, call activatedDevice(_:session:).

Declaring Domains

Declare the domains your extension may need to connect to in your extension’s Info.plist using MDRequestedDomains. The type must conform to an array of strings:

<key>EXAppExtensionAttributes</key>
<dict>
    <key>MDRequestedDomains</key>
        <array>
            <string>https://www.apple.com</string>
            <string>https://www.icloud.com</string>
        </array>
</dict>

Grouping

If the extension receives multiple activations, then the associated MediaOutputDevice instances should be grouped together. If the devices are already members of a group, then those groups should now be considered grouped together. updateDevices(_:) should be called to update the state of group information.