Skip to main content
Version: 1.3.x

AIPlayer Callback

1. onAIPlayerError

Callback for Errors during AIPlayer operation

ParamTypeDescription
jsonObjectarguments of the onAIPlayerError
json.errorStringerror information
json.errorCodeNumbererror code
json.descriptionStringError Description
json.detailStringError Detail
  • Example
  AI_PLAYER.onAIPlayerError = function (err) {
// err => { errorCode: 1400, error: "...", description: "...", detail: "..." }
};

2. onAIPlayerStateChanged

Callback for AIPlayer State Change

  • Callback Parameter

    ParamTypeValueDescription
    stateString'playerLoadStarted' | 'playerLoadComplete' | 'speakingPrepareStarted' | 'speakingPrepareComplete' | 'speakingStarted' | 'speakingComplete' |AIPlayer

    state

  • Example

  AI_PLAYER.onAIPlayerStateChanged = function (state) {
if (state === "playerLoadStarted") {
// ...
}

// ...
};

3. onAIPlayerLoadingProgressed

Callback for AIPlayer Loading Progress

  • Callback Parameter

    ParamTypeDescription
    jsonObjecta callback response from onAIPlayerLoadingProgressed
    json.loadingNumberloading process percent (1 ~ 100)
  • Example

  AI_PLAYER.onAIPlayerLoadingProgressed = function (result) {
console.log(`loading process: ${result.loading || 0}%`);
};