public class QwenTtsRealtime
extends okhttp3.WebSocketListener
| 构造器和说明 |
|---|
QwenTtsRealtime(QwenTtsRealtimeParam param,
QwenTtsRealtimeCallback callback)
Constructor
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
appendText(String text)
Send text
|
void |
cancelResponse()
cancel the current response
|
void |
checkStatus() |
void |
clearAppendedText()
Clear the text sent to server before.
|
void |
close()
close the connection to server
|
void |
close(int code,
String reason)
close the connection to server
|
void |
commit()
Commit the text sent before, create response and start synthesis audio.
|
void |
connect()
Connect to server, create session and return default session configuration
|
void |
finish()
finish input text stream, server will synthesis all text in buffer and close the connection
|
long |
getFirstAudioDelay() |
String |
getResponseId() |
String |
getSessionId() |
void |
onClosed(okhttp3.WebSocket webSocket,
int code,
String reason) |
void |
onClosing(okhttp3.WebSocket webSocket,
int code,
String reason) |
void |
onFailure(okhttp3.WebSocket webSocket,
Throwable t,
okhttp3.Response response) |
void |
onMessage(okhttp3.WebSocket webSocket,
String text) |
void |
onOpen(okhttp3.WebSocket webSocket,
okhttp3.Response response)
WebSocket callbacks
|
void |
sendRaw(String rawData)
send raw data to server
|
void |
updateSession(QwenTtsRealtimeConfig config)
Update session configuration, should be used before append text
|
public QwenTtsRealtime(QwenTtsRealtimeParam param, QwenTtsRealtimeCallback callback)
param - apikey, model, url, etc.callback - callbackpublic void checkStatus()
public void connect()
throws NoApiKeyException,
InterruptedException
public void updateSession(QwenTtsRealtimeConfig config)
config - session configurationpublic void appendText(String text)
text - text to sendpublic void commit()
public void clearAppendedText()
public void cancelResponse()
public void finish()
public void close()
public void close(int code,
String reason)
code - websocket close codereason - websocket close reasonpublic void sendRaw(String rawData)
rawData - raw datapublic String getSessionId()
public String getResponseId()
public long getFirstAudioDelay()
public void onOpen(okhttp3.WebSocket webSocket,
okhttp3.Response response)
onOpen 在类中 okhttp3.WebSocketListenerpublic void onMessage(okhttp3.WebSocket webSocket,
String text)
onMessage 在类中 okhttp3.WebSocketListenerpublic void onClosed(okhttp3.WebSocket webSocket,
int code,
String reason)
onClosed 在类中 okhttp3.WebSocketListenerpublic void onClosing(@NotNull
okhttp3.WebSocket webSocket,
int code,
@NotNull
String reason)
onClosing 在类中 okhttp3.WebSocketListenerpublic void onFailure(okhttp3.WebSocket webSocket,
Throwable t,
okhttp3.Response response)
onFailure 在类中 okhttp3.WebSocketListenerCopyright © 2025. All rights reserved.