abalabahaha / opusscript

JS bindings for libopus 1.4, ported with Emscripten
MIT License
63 stars 19 forks source link

opusscript_native.OpusScriptHandler is not a function #6

Closed arafinski closed 7 years ago

arafinski commented 7 years ago

Whenever I try to instantiate the encoder with // Optimize encoding for audio. Available applications are VOIP, AUDIO, and RESTRICTED_LOWDELAY var encoder = new opusscript(samplingRate, channels, opusscript.Application.AUDIO); I get the Uncaught TypeError: opusscript_native.OpusScriptHandler is not a function at new OpusScript opusscipt/index.js 33:39

abalabahaha commented 7 years ago

It's possible your install got corrupted somewhere, as this shouldn't be happening at all... Can you try reinstalling a fresh copy of opusscript? (npm remove opusscript && npm cache clean && npm install opusscript@0.0.3)

arafinski commented 7 years ago

just tried your suggestion, unfortunately same result. I am trying to run it on a rasberry pi model 3, wrapped in electron

abalabahaha commented 7 years ago

Thanks for the report. After playing around with Electron, it seems that Emscripten's module loader wasn't exporting OpusScriptHandler because it thinks browsers can't be Node environments, so I overrode this behavior. This fix is released in opusscript@0.0.4 on NPM.

arafinski commented 7 years ago

awesome! thank you very much