Friday, 28 April 2017

Why socket.emit doesn't working when to send ArrayBuffer on Edge?

I want to send streaming data using socket.io from Edge.

Edge 38.14393.1066.0
EdgeHTML 14.14393
Socket.IO 1.7.3

navigator.getUserMedia( {
    video: false,
    audio: true
}, stream => {
    let audioContext      = new AudioContext()
    let mediaStreamSource = audioContext.createMediaStreamSource( stream )
    let scriptProcessor   = audioContext.createScriptProcessor( 4096, 1, 1 )
    scriptProcessor.onaudioprocess = e => {
        let inputBuffer = e.inputBuffer
        let inputData   = inputBuffer.getChannelData( 0 )

        socket.emit( 'audio', inputData.buffer )
    }
    mediaStreamSource.connect( scriptProcessor )
    scriptProcessor.connect( audioContext.destination )
}, console.error )

I got this error on Edge.

[TypedArray]: The ArrayBuffer is detached
http://localhost:3000/socket.io/socket.io.js
2
18260

It seems that there was an error with Uint8Array. Why this code doesn't working ? :(



via Calmery

No comments:

Post a Comment