I bought the HomePod mini because it can play stereo with two units, but when I tried using it, it was when using AirPlay 2. I connected a record player to a Macintosh with LINE input, so I dreamed that the record would play in stereo, but the QuickTime Player used to connect the sound input to the output does not support AirPlay 2. , Stereo playback is not possible. In the first place, it is troublesome to use QuickTime Player, so I investigated the procedure for AirPlay 2 in order to create an application that plays the sound of the record player.
Set .longForm in route-sharing policy of AVAudioSession
let audioSession = AVAudioSession.sharedInstance() try audioSession.setRouteSharingPolicy(.longForm)
let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory(AVAudioSessionCategoryPlayback, mode: AVAudioSessionModeDefault, routeSharingPolicy: .longForm )
Use AVRouteDetector to check if there is an output destination, and select the output destination with AVRoutePickerView.
Allow playback to be controlled using MPRemoteCommandCenter. Information on the media being played is obtained from MPNowPlayingInfoCente.
Use AVPlayer or AVQueuePlayer, or play with AVSampleBufferAudioRenderer and AVSampleBufferRenderSynchronizer.
I found a sample code, though there is little information.