---
title: "play(atTime:)"
framework: avfaudio
role: symbol
role_heading: Instance Method
path: "avfaudio/avaudioplayer/play(attime:)"
---

# play(atTime:)

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

## Declaration

```swift
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

Return Value true if playback starts successfully; otherwise, false.

## Discussion

Discussion Use this method to precisely synchronize the playback of two or more audio player objects as the following example shows: 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() if the audio player is unprepared for playback.

## See Also

### Controlling playback

- [prepareToPlay()](avfaudio/avaudioplayer/preparetoplay().md)
- [play()](avfaudio/avaudioplayer/play().md)
- [pause()](avfaudio/avaudioplayer/pause().md)
- [stop()](avfaudio/avaudioplayer/stop().md)
- [isPlaying](avfaudio/avaudioplayer/isplaying.md)
