SinchRemoteAudioFrameDelegate
public protocol SinchRemoteAudioFrameDelegate : AnyObject
The delegate for remote audio playout events.
The callbacks allow observing and modifying the decoded PCM audio received from the remote party before it is written to the audio output device.
Assign via SinchAudioController.remoteAudioFrameDelegate.
Important
All callbacks are delivered synchronously on the SDK’s internal real-time audio threads, in the orderaudioPlayoutDidStart(with:),
onRemoteAudioFrame(_:), audioPlayoutDidStop(with:). Implementations
must not block — any significant delay will cause audio glitches.
-
Called for every 10 ms audio buffer received from the remote party, before it is written to the audio output device.
The frame contains interleaved 16-bit PCM samples; the sample rate and the number of channels are described by
frame.format. The samples may be modified in-place (viaframe.int16ChannelData) to transform the audio before it is played out (e.g. gain adjustment, filtering).Important
The frame buffer is only valid for the duration of this method call and must not be retained or accessed afterwards.
Declaration
Swift
func onRemoteAudioFrame(_ frame: AVAudioPCMBuffer) -> BoolParameters
frameBuffer containing the decoded PCM samples. Safe to read and modify in-place.
Return Value
trueto play out the frame contents (as-is or modified);falseto discard the frame and play silence instead. -
audioPlayoutDidStart(with:Default implementation) Called when remote audio playout has started, before the first
onRemoteAudioFrame(_:)call.Optional — implement to initialize per-session state that depends on the playout format. A single delegate may observe several playout sessions; this is invoked at the start of each one.
Default Implementation
Declaration
Swift
func audioPlayoutDidStart(with format: AVAudioFormat)Parameters
formatPlayout format in use.
-
audioPlayoutDidStop(with:Default implementation) Called when remote audio playout has stopped, after the final
onRemoteAudioFrame(_:)call; no further frames will be delivered for this session. Audio already handed to the output device may continue to play out briefly after this method call.Optional — implement to release any resources allocated in
audioPlayoutDidStart(with:).Default Implementation
Declaration
Swift
func audioPlayoutDidStop(with format: AVAudioFormat)Parameters
formatPlayout format that was in use.