---
title: "beats(forHostTime:error:)"
framework: avfaudio
role: symbol
role_heading: Instance Method
path: "avfaudio/avaudiosequencer/beats(forhosttime:error:)"
---

# beats(forHostTime:error:)

Gets the beat the system plays at the specified host time.

## Declaration

```swift
func beats(forHostTime inHostTime: UInt64, error outError: NSErrorPointer) -> AVMusicTimeStamp
```

## Parameters

- `inHostTime`: The host time for the beat position.
- `outError`: On exit, if an error occurs, a description of the error.

## Discussion

Discussion This call is valid when the player is in a playing state. It returns 0 with an error, otherwise, or if the starting position of the player is after the specified host time. This method uses the sequence’s tempo map to retrieve a beat time from the specified host time.

## See Also

### Handling Beat Range

- [beats(forSeconds:)](avfaudio/avaudiosequencer/beats(forseconds:).md)
- [AVMusicTimeStampEndOfTrack](avfaudio/avmusictimestampendoftrack.md)
- [AVBeatRange](avfaudio/avbeatrange-swift.typealias.md)
