BZVoiceFlowCallback Protocol Reference
Declared in | BZVoiceFlowCallback.swift |
Overview
The BZVoiceFlowCallback protocol defines the optional callback methods implemented by an application class that subclasses this protocol in order to receive real time callbacks with events during Voiceflow processing from BZVoiceFlow
framework . A class initializing an instance of BZVoiceFlowController
must be a subclass of BZVoiceFlowCallback
and must provide implementation of the protocol methods in order to receive Voiceflow processing callbacks from BZVoiceFlow
Framework.
Note: Voiceflow processing generating callbacks from BZVoiceFlow
framework cover most of the events needed by an application including a subset of realtime event notifications from BZMedia
framework. For a complete set of realtime event notifications from BZMedia
framework, the application must implement bzMedia_EventNotification
function from BZEventsObserverDelegate
.
Note: VoiceFfow processing callbacks from BZVoiceFlow
framework occur on the main thread of an application. The application should be careful not to tie its main thread with complex and time consuming tasks so these callbacks and events are received timely. Also the application should release the callback and event notfication methods quickly without leveraging these methods to execute complex and time comsuming tasks.
Sample implementation code:
#import BZVoiceFlow_Framework
public final class MyVoiceFlowClass: NSObject, BZVoiceFlowCallback {
var bzEventsObserver: BZEventsObserver? = nil
var bzVoiceFlowController: BZVoiceFlowController? = nil
func InitializeBZVoiceFlowController () {
bzVoiceFlowController = BZVoiceFlowController()
_ = bzVoiceFlowController.initialize()
bzVoiceFlowController!.setVoiceFlowCallback(self)
}
// Optional implementation of callback methods from BZVoiceFlowCallback protocol
func BZVFC_PreModuleStart(vfModuleID: String) {
}
func BZVFC_PreModuleEnd(vfModuleID: String) {
}
func BZVFC_SRHypothesis(vfModuleID: String, srData: BZSRData) {
}
func BZVFC_MediaEvent(vfModuleID: String, mediaItemID: String, mediaFunction:BZNotifyMediaFunction, mediaEvent:BZNotifyMediaEvent, mediaEventData: [AnyHashable : Any]) {
}
func BZVFC_PlayAudioSegmentData(vfModuleID: String, promptID:String, audioSegmentType:BZAudioSegmentType, audioFile: String?, textString: String?, textFile: String?) {
}
func BZVFC_PermissionEvent(permissionEvent:BZNotifyMediaEvent) {
}
}
Tasks
-
– BZVFC_PreModuleStart
Call back to application just before Voiceflow processing of a Voiceflow module starts.
-
– BZVFC_PreModuleEnd
Call back to application just before Voiceflow processing of a Voiceflow module ends.
-
– BZVFC_SRHypothesis
Call back to application with speech recognition data genrated by an SR Hypothesis.
-
– BZVFC_MediaEvent
Call back to application with media event notification.
-
– BZVFC_PlayAudioSegmentData
Call back to application with an event notifcation indicating the start of audio playback of an audio segment.
-
– BZVFC_PermissionEvent
Call back to application with the result of a permission request.
permissionEvent
can have one of the following value:- BZNotifyMediaEvent.NME_MICROPHONE_PERMISSION_GRANTED - BZNotifyMediaEvent.NME_MICROPHONE_PERMISSION_DENIED - BZNotifyMediaEvent.NME_SPEECHRECOGNIZER_PERMISSION_GRANTED - BZNotifyMediaEvent.NME_SPEECHRECOGNIZER_PERMISSION_DENIED
Instance Methods
BZVFC_MediaEvent
func BZVFC_MediaEvent(vfModuleID: String, mediaItemID: String, mediaFunction:BZNotifyMediaFunction, mediaEvent:BZNotifyMediaEvent, mediaEventData: [AnyHashable : Any])
Discussion
Call back to application with media event notification.
Parameters
vfModuleID
The Voice Flow module ID.
mediaItemID
The ID of the media item being processed for which this media event notification applies.
mediaFunction
The media function.
mediaEvent
The media event.
mediaEventData
The media event data.
Declared In
BZVoiceFlowCallback.swift
BZVFC_PermissionEvent
func BZVFC_PermissionEvent(permissionEvent:BZNotifyMediaEvent)
Discussion
Call back to application with the result of a permission request. permissionEvent
can have one of the following value:
- BZNotifyMediaEvent.NME_MICROPHONE_PERMISSION_GRANTED - BZNotifyMediaEvent.NME_MICROPHONE_PERMISSION_DENIED - BZNotifyMediaEvent.NME_SPEECHRECOGNIZER_PERMISSION_GRANTED - BZNotifyMediaEvent.NME_SPEECHRECOGNIZER_PERMISSION_DENIED
Parameters
permissionEvent
The result of the permission request.
Declared In
BZVoiceFlowCallback.swift
BZVFC_PlayAudioSegmentData
func BZVFC_PlayAudioSegmentData(vfModuleID: String, promptID:String, audioSegmentType:BZAudioSegmentType, audioFile: String?, textString: String?, textFile: String?)
Discussion
Call back to application with an event notifcation indicating the start of audio playback of an audio segment.
Parameters
vfModuleID
The Voice Flow module ID.
promptID
The audio prompt module ID.
promptType
The audio segment type.
audioFile
The file name of the recorded audio file processed for audio playback.
textString
The text processed for audio playback.
textFile
The file name of the text file containing the text processed for audio playback.
Declared In
BZVoiceFlowCallback.swift
BZVFC_PreModuleEnd
func BZVFC_PreModuleEnd(vfModuleID: String)
Discussion
Call back to application just before Voiceflow processing of a Voiceflow module ends.
Parameters
vfModuleID
The Voice Flow module ID.
Declared In
BZVoiceFlowCallback.swift
BZVFC_PreModuleStart
func BZVFC_PreModuleStart(vfModuleID: String)
Discussion
Call back to application just before Voiceflow processing of a Voiceflow module starts.
Parameters
vfModuleID
The Voice Flow module ID.
Declared In
BZVoiceFlowCallback.swift
BZVFC_SRHypothesis
func BZVFC_SRHypothesis(vfModuleID: String, srData: BZSRData)
Discussion
Call back to application with speech recognition data genrated by an SR Hypothesis.
Parameters
vfModuleID
The Voice Flow module ID.
srData
The speech recognition result data.
Declared In
BZVoiceFlowCallback.swift