diff --git a/src/polyfill/RTCDataChannel.ts b/src/polyfill/RTCDataChannel.ts index 7515b2a..70756af 100644 --- a/src/polyfill/RTCDataChannel.ts +++ b/src/polyfill/RTCDataChannel.ts @@ -73,7 +73,10 @@ export default class RTCDataChannel extends EventTarget implements globalThis.RT this.#dataChannel.onMessage((data) => { if (ArrayBuffer.isView(data)) { - data = Buffer.from(data.buffer); + if (this.binaryType=="arraybuffer") + data = data.buffer; + else + data = Buffer.from(data); } this.dispatchEvent(new MessageEvent('message', { data }));