forked from Blendman974/faceclaw
Add Soniox as an API speech-to-text option
This commit is contained in:
1 parent
852626e950
commit
ba81e46624
9 files changed
+218
-14
No files matched your search
@@ -11,10 +11,11 @@ import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.WebSocket;
|
||||
import okhttp3.WebSocketListener;
|
||||
import okio.ByteString;
|
||||
|
||||
/**
|
||||
* Thin okhttp WebSocket wrapper for the TypeScript side. Text frames only
|
||||
* (the g2mirror protocol is JSON-in-text-frames). Listener callbacks are
|
||||
* Thin okhttp WebSocket wrapper for the TypeScript side. Sends text frames
|
||||
* (JSON protocols) and binary frames (raw audio for Soniox). Listener callbacks are
|
||||
* posted to the Looper of the thread that constructed this object, so a JS
|
||||
* isolate (main thread or app worker) always receives them on its own
|
||||
* thread; a Looper-less constructing thread falls back to the main thread.
|
||||
@@ -132,6 +133,10 @@ public class FaceclawWebSocket {
|
||||
return socket.send(message == null ? "" : message);
|
||||
}
|
||||
|
||||
public boolean sendBinary(byte[] bytes) {
|
||||
return socket.send(ByteString.of(bytes == null ? new byte[0] : bytes));
|
||||
}
|
||||
|
||||
public void close(int code, String reason) {
|
||||
closeRequested = true;
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user