<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/Entity/playAudio(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation6EntityC9playAudioyAA0E18PlaybackControllerCAA0E8ResourceCF"
  },
  "title" : "playAudio(_:)"
}
-->

# playAudio(_:)

Prepares and plays a new audio playback instance on this entity.

```
@discardableResult @MainActor @preconcurrency func playAudio(_ resource: AudioResource) -> AudioPlaybackController
```

## Parameters

`resource`

The audio resource the method plays.
Load an audio resource from the file system with
[`init(named:in:configuration:)`](/documentation/RealityKit/AudioFileResource/init(named:in:configuration:)) ,
or from a URL with
[`init(contentsOf:withName:configuration:)`](/documentation/RealityKit/AudioFileResource/init(contentsOf:withName:configuration:)).

## Return Value

An [`AudioPlaybackController`](/documentation/RealityKit/AudioPlaybackController) object that you can use to start and
stop audio playback for this specific instance of a resource playing on this entity.
You can also use this controller to update playback properties, such as gain and speed, during playback.

## Discussion

The method prepares the audio by calling
[`prepareAudio(_:)`](/documentation/RealityKit/Entity/prepareAudio(_:)), and then immediately calls the
[`play()`](/documentation/RealityKit/AudioPlaybackController/play()) method of the controller that it returns.
To begin multiple playback instances you can call `playAudio` multiple times.

---

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)