<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioPlayer/play(atTime:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioPlayer(im)playAtTime:"
  },
  "title" : "play(atTime:)"
}
-->

# play(atTime:)

Plays audio asynchronously, starting at a specified point in the audio output device’s timeline.

```
func play(atTime time: TimeInterval) -> Bool
```

## Parameters

`time`

The audio device time to begin playback. This time must be later than the device’s current time.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if playback starts successfully; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

Use this method to precisely synchronize the playback of two or more audio player objects as the following example shows:

```swift
func startSynchronizedPlayback() {
    // Create a time offset relative to the current device time.
    let timeOffset = playerOne.deviceCurrentTime + 0.01
    
    // Start playback of both players at the same time.
    playerOne.play(atTime: timeOffset)
    playerTwo.play(atTime: timeOffset)
}
```

Calling this method implicitly calls [`prepareToPlay()`](/documentation/AVFAudio/AVAudioPlayer/prepareToPlay()) if the audio player is unprepared for playback.

---

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)