<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/Audio/playAudio(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation5AudioO04playC0yAA0C23PlaybackGroupControllerCSayAA0C8ResourceC_AA6EntityCtGKFZ"
  },
  "title" : "playAudio(_:)"
}
-->

# playAudio(_:)

Prepares and plays multiple audio resources for synchronized playback

```
@discardableResult @MainActor static func playAudio(_ resourcesAndEntities: [(AudioResource, Entity)]) throws -> AudioPlaybackGroupController
```

## Parameters

`resourcesAndEntities`

An array of tuples containing audio
resources and their associated entities. The same entity can appear
multiple times with different resources.

## Return Value

An `AudioPlaybackGroupController` for the synchronized group.

## Discussion

This method creates an `AudioPlaybackGroupController` that coordinates
playback across multiple entity/resource pairs. All audio sources in
the group will be synchronized to sample-accurate precision.
After the controller is created, the [`play()`](/documentation/RealityKit/AudioPlaybackGroupController/play())
method of the controller that it returns is immediately called.

> Throws: An error if the audio preparation fails.

## Usage Notes

- The same entity can be used with multiple resources in the same group
- Entities can participate in multiple groups simultaneously
- The completion handler fires when the longest resource finishes

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)