If you're using an M1 or M2 iPad with an external monitor you'll have noticed that the only audio available is that monitor. If there are no speakers or if the built in monitor speakers are lousy you have a couple choices for audio. Of course, AirPods are an option. Bluetooth to an audio speaker. If the monitor has an audio out you could plug in speakers. But HomePods are another option.

It might seem at first that this won't work. When using Music or the TV app, if you select HomePods from the AirPlay widget you'll get an error: "AirPlay is unavailable while an external display is connected." A screenshot of the Music app on the iPad with an error message that reads: AirPlay is unavailable while an external display is connected.

The solution is a simple shortcut. Run this and you can play audio to your HomePods when connected to an external monitor. If you pause playback for for more than a few minutes you'll have to re-run it because audio will default back to the connected monitor.

A screenshot of a 2 step Shortcut. The first step: Set playback destination to Cabin
The second step:Set volume to 50%

Other benefits of using this Shortcut: It seems to connect a bit faster than using the built in AirPlay widget found in apps. When I use that widget in the Music or Podcast app it actually transfers "ownership" of the audio stream to the HomePods. So, really, it's not AirPlaying the stream from the iPad/iPhone to the HomePods but rather the HomePods become the new source device:

A screenshot showings the Music app on an iPad. A yellow box around the text Cabin demonstrates that audio is being played by a pair of HomePod speakers called Cabin

When using the Shortcut the iPad or iPhone remains the source device and pushes the audio to the HomePods:

A screenshot showings the Music app on an iPad. A yellow box around the text iPad>Cabin demonstrates that audio is being sent from an iPad to HomePod speakers called Cabin

Another benefit when using the Shortcut is bedtime playing of a podcast. By using the shortcut method I can set the sleep timer in the Podcast app from the device. This isn't an option when using the AirPlay widget.