TTSAgentProtocol

public protocol TTSAgentProtocol : CapabilityAgentable

The TTSAgent handles directives for controlling speech playback.

  • Returns the current time of the current player item.

    This function retrieves the offset(seconds) of the current MediaPlayable handled by the TTSAgent.

    Declaration

    Swift

    var offset: Int? { get }
  • The duration of the current player item.

    This function retrieves the duration(seconds) of the current MediaPlayable handled by the TTSAgent.

    Declaration

    Swift

    var duration: Int? { get }
  • The audio playback volume for the player.

    This function retrieves the volume of the current MediaPlayable handled by the TTSAgent.

    Declaration

    Swift

    var volume: Float { get set }
  • The cancellation policy when playback is implicitly stopped.

    Declaration

    Swift

    var directiveCancelPolicy: DirectiveCancelPolicy { get set }
  • Adds a delegate to be notified of TTSState changes.

    Declaration

    Swift

    func add(delegate: TTSAgentDelegate)

    Parameters

    delegate

    The object to add.

  • Removes a delegate from TTSAgent.

    Declaration

    Swift

    func remove(delegate: TTSAgentDelegate)

    Parameters

    delegate

    The object to remove.

  • Request voice synthesis and playback.

    Declaration

    Swift

    @discardableResult
    func requestTTS(
        text: String,
        playServiceId: String?,
        handler: ((_ ttsResult: TTSResult, _ dialogRequestId: String) -> Void)?
    ) -> String

    Parameters

    text

    The obejct to request speech synthesis.

    playServiceId

    The unique identifier to specify play service.

  • Stops playback

    Declaration

    Swift

    func stopTTS(cancelAssociation: Bool)

    Parameters

    cancelAssociation

    true: cancel all associated directives, false : only stop tts

Default

  • requestTTS(text:) Extension method

    Request voice synthesis and playback.

    Declaration

    Swift

    @discardableResult
    func requestTTS(text: String) -> String

    Parameters

    text

    The obejct to request speech synthesis.

  • <#Description#>

    Declaration

    Swift

    @discardableResult
    func requestTTS(text: String, playServiceId: String?) -> String

    Parameters

    text

    <#text description#>

    playServiceId

    <#playServiceId description#>

    Return Value

    <#description#>

  • requestTTS(text:handler:) Extension method

    <#Description#>

    Declaration

    Swift

    @discardableResult
    func requestTTS(text: String, handler: ((_ ttsResult: TTSResult, _ dialogRequestId: String) -> Void)? = nil) -> String

    Parameters

    text

    <#text description#>

    handler

    <#handler description#>

    Return Value

    <#description#>

  • stopTTS() Extension method

    Stops playback

    Declaration

    Swift

    func stopTTS()