Skip to content

Commit

Permalink
feat: send back raw buffer instead of ArrayBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
naomi-lgbt committed Oct 1, 2024
1 parent 2a03f9a commit 298df5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/packages/SpeakLiveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class SpeakLiveClient extends AbstractLiveClient {
* Handles binary messages received from the WebSocket connection.
* @param data - The binary data.
*/
protected handleBinaryMessage(data: ArrayBuffer): void {
protected handleBinaryMessage(data: Buffer): void {
this.emit(LiveTTSEvents.Audio, data);
}

Expand Down Expand Up @@ -149,9 +149,9 @@ export class SpeakLiveClient extends AbstractLiveClient {
});
}
} else if (event.data instanceof ArrayBuffer) {
this.handleBinaryMessage(event.data);
this.handleBinaryMessage(Buffer.from(event.data));
} else if (Buffer.isBuffer(event.data)) {
this.handleBinaryMessage(event.data.buffer);
this.handleBinaryMessage(event.data);
} else {
console.log("Received unknown data type", event.data);
this.emit(LiveTTSEvents.Error, {
Expand Down

0 comments on commit 298df5c

Please sign in to comment.