Skip to main content
Version: 1.4.x

AIPlayer

Modifier and TypeMethod and Description
java.lang.StringgetAIName() get the name of the currently set ai
floatgetScale() get the scale of the currently set ai
floatgetSpeed() get the speed of the currently set ai
IAIPlayer.AIPlayerTypegetType()get the type of the currently set ai. Currently only AIHuman Type.
voidinit(AIPlayerSettings config, IAIPlayerCallback callback) initialize the ai with config and set callback
voidpause()pause the speech if possible
voidpreload(java.lang.String request) preload speech
voidpreload(java.lang.String[] requests) preload speechs
voidpreload(AIClipSet request) preload speech with gesture
voidpreload(AIClipSet[] requests)preload speechs with gesture
voidrelease()release the aiplayer when done. Similar to 'onDestroy()'.
voidresume() resume the speech if possible
voidsend(java.lang.String request) send speech to speak
voidsend(java.lang.String[] requests) send speeches to speak
voidsend(AIClipSet requests) send speech with gesture
voidsend(AIClipSet[] requests) send speeches with gesture
voidsetScale(float scale) set the scale of ai
voidsetSpeed(float speed) set the ai speech rate
voidsetTopMargin(int topMargin) set top margin of ai to be displayed
voidstopSpeaking() stop speech if possible and clear all sentences in queue if possible
AIGesture[]getGestures() get gesture list.
booleansetCustomVoice(CustomVoice customVoice) set the CustomVoice of ai. return true if it succeeds. Null input will revert the voice to the default voice.
booleansetCustomVoiceForLanguage(String language, String gender) Set the voice by the desired language and gender. The AI's default language will be set when null for language is entered and this method returns true. If the language is not valid, also the default AI's voice will be set and returns false. When null is entered in gender, the AI's gender will be set and searched. And the voice will be set the first voice among the search result list. If the search and setting succeed, it returns true. Otherwise the default voice will be set and returns false.
CustomVoicegetCustomVoice() get the current customVoice of set ai. It returns null if not set.
StringgetLanguageCode() get current voice's language (en or en-US format)
StringgetGender() get current ai's gender. MALE, FEMALE, UNI are possible and return null if the ai is not set.
AIPlayerStategetState() get current AIPlayer's State
voidsetVolume(float volume) set the Volume. 0 ~ 1
floatgetVolume() get current Volume.
booleanisConnected() check if AI is connected and can send
booleancanPreload() check if AI is able to preload
booleanreconnect(IAIReconnectCallback reconnectCallback) reconnect when AI is not connected. Return false if it is connected or can't reconnect.