AVAudioPlayer.PlayAtTime(Double) Method

Definition

Begins playback at a certain delay, relative to the current playback time.

[Foundation.Export("playAtTime:")]
public virtual bool PlayAtTime (double time);
abstract member PlayAtTime : double -> bool
override this.PlayAtTime : double -> bool

Parameters

time
Double

Returns

Attributes

Remarks

The value of time must be greater than or equal to the DeviceCurrentTime property (use CurrentTime to move the playhead back in time, if necessary).

Multiple AVAudioPlayers can be synchronized using this method:

var shortStartDelay = 0.01;
var now = player.DeviceCurrentTime;
player.PlayAtTime(now + shortStartDelay);
player2.PlayAtTime(now + shortStartDelay);

Applies to