VIAudioFileDelegate
VoximplantCore · iOS SDK v3
Protocol that provides methods to handle VIAudioFile playback events.
@objc protocol VIAudioFileDelegate
All methods are optional. Events are delivered on delegateQueue.
Methods
audioFile(_:didStartPlaying:)
@objc optional func audioFile(_ audioFile: VIAudioFile, didStartPlaying error: VIAudioFileError?)
Triggered when playback start succeeds or fails.
Parameters
audioFile VIAudioFile
Audio file instance.
error VIAudioFileError?
nil on success; otherwise a VIAudioFileError describing why start failed
audioFile(_:didStopPlaying:)
@objc optional func audioFile(_ audioFile: VIAudioFile?, didStopPlaying error: VIAudioFileError?)
Triggered when playback stops.
Parameters
audioFile VIAudioFile?
Audio file instance, or nil if the instance was deallocated while playing.
error VIAudioFileError?
nil for a user-initiated pause/stop or a successful natural finish; otherwise a VIAudioFileError describing why playback stopped.
Invoked for pause(), stop(), natural finish, failures, CallKit activation, interruptions, media services loss, and deallocation while playing.
audioFile(_:interruptionDidEnd:)
@objc optional func audioFile(_ audioFile: VIAudioFile, interruptionDidEnd shouldResume: Bool)
Triggered when an audio session interruption that affected playback has ended.
Parameters
audioFile VIAudioFile
Audio file instance.
shouldResume Bool
true if the system indicates playback may resume (from AVAudioSession interruption options).
Use this to decide whether to call play() or playLooped() again.