fix: convert Uint8Array to Buffer in _bufferToFloat32

LiveKit SDK returns audio data as Uint8Array/ArrayBuffer, not Node.js Buffer.
Added Buffer.from() conversion before readInt16LE operations.

Fixes: TypeError: buffer.readInt16LE is not a function
Permet à l'audio reçu des clients d'être converti en Float32 pour lecture.
This commit is contained in:
2026-05-28 15:05:01 +02:00
parent adadbfeeb7
commit cfeb275d18
2 changed files with 37980 additions and 59 deletions
+5
View File
@@ -578,6 +578,11 @@ export class AudioBridge extends EventEmitter {
* @private
*/
_bufferToFloat32(buffer) {
// Convertir en Buffer Node.js si c'est un Uint8Array ou ArrayBuffer
if (!(buffer instanceof Buffer)) {
buffer = Buffer.from(buffer);
}
const samples = buffer.length / 2; // 2 bytes per sample (16-bit)
const float32 = this._acquireFloat32Buffer(samples);
File diff suppressed because one or more lines are too long