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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user