I've got a streaming Radio app that loads an HLS stream into an AVAudioPlayer. I've set up an Intents extension that notifies SiriKit that my app must handle the INPlayMediaIntent in app, and, I'm able to successfully initiate the stream playing from my phone using the string "Play <my app name>".
My intent handler in app looks like this:
completionHandler(INPlayMediaIntentResponse(code: .success, userActivity: nil))
DispatchQueue.main.async {
AudioPlayerService.shared.play()
}
The Audio Player service, in its init, does the following:
try AVAudioSession.sharedInstance().setCategory(
.playback,
mode: .default,
policy: .longFormAudio
)
Additionally, in my Info.plist, I have the AirPlay optimization policy set to Long Form Audio.
Having said all that, when I try to route my app to play "on a given HomePod speaker" ("play <my app name> on <speaker name>") the speaker routing instructions are never followed. I've looked and not been able to find where I might be able to instruct my app to follow the correct path here. I was assuming I could not trigger this behavior manually, as I believe I don't really have any control over AirPlay routing.
Is there any guidance for working with SiriKit to do the right thing with regards to audio routing?