 	func windowWillClose(_ notification: Notification) {
 		player.stop()
 
-		if let uid = try? player.outputDevice.deviceUID() {
+		if let uid = try? getAudioObjectProperty(PropertyAddress(kAudioDevicePropertyDeviceUID), from: player.outputDeviceID, type: CFString.self) as String {
 			UserDefaults.standard.set(uid, forKey: "deviceUID")
 		}
 

			return
		}

		try? player.setOutputDevice(device)
	}

	// MARK: - Player Control

					continue
				}

				let isActiveDevice = outputDevice.objectID == currentOutputDeviceID
				let deviceMenuItem = NSMenuItem(title: try outputDevice.name(), action: #selector(PlayerWindowController.selectDevice(_:)), keyEquivalent: "")
				deviceMenuItem.target = self
				deviceMenuItem.representedObject = outputDevice
