Contents

record(atTime:)

Records audio starting at a specific time.

Declaration

func record(atTime time: TimeInterval) -> Bool

Parameters

Return Value

true if recording starts successfully; otherwise, false.

Discussion

You can call this method on a single recorder, or use it to synchronize the recording of multiple players as shown below.

func startSynchronizedRecording() {
    // Create a time offset relative to the current device time.
    let timeOffset = recorderOne.deviceCurrentTime + 0.01
    
    // Synchronize the recording time of both recorders.
    recorderOne.record(atTime: timeOffset)
    recorderTwo.record(atTime: timeOffset)
}

Calling this method implicitly calls prepareToRecord(), which creates an audio file and prepares the system for recording.

See Also

Controlling recording