Closed AniketBhadane closed 4 years ago
Haven't touched Angular in a while, but try adding those as empty node modules to your webpack
config:
node: {
fs: 'empty',
path: 'empty'
}
I don't have a webpack config file. Is there an alternate way?
Can you install 8f8ffd1 (npm i abalabahaha/opusscript#8f8ffd1
) and see if that makes a difference in building?
The build was successful, but during execution I'm getting error:
Error: abort(sync fetching of the wasm failed: you can preload it to Module['wasmBinary'] manually, or emcc.py will do that for you when generating HTML (but not JS)). Build with -s ASSERTIONS=1 for more info.
My code is:
let encoder = new OpusScript(8000, 1, OpusScript.Application.AUDIO);
let opusData = new Buffer(this.myOggContents);
let decodedPacket = encoder.decode(opusData);
let blob = new Blob([decodedPacket]);
let bUrl = window.URL.createObjectURL(blob);
Try disabling WASM import: new OpusScript(8000, 1, OpusScript.Application.AUDIO, { wasm: false });
Expected 1-3 arguments, but got 4.
Right, Typescript... Added typings, npm i abalabahaha/opusscript#9a06f76
Now getting
RangeError: Source is too large
in this line in index.js:
this.inOpus.set(buffer);
Also, previously I had got error that - ReferenceError: Buffer is not defined So I had added following to polyfills.ts:
(window as any).global = window;
// @ts-ignore
window.Buffer = window.Buffer || require('buffer').Buffer;
For the RangeError
, .decode()
takes in exactly 1 opus packet, make sure myOggContents
/opusData
meets that requirement.
As for the Buffer
and other polyfills, this module was primarily intended for Node.js operation, so some things probably need polyfill/hacks to work in the browser. Curious as to what you are using this library for, under what browser environments? I may consider adding proper browser support if there is enough use cases for that.
Closing due to inactivity, please reopen if you still have issues.
I am trying to write a Mumble Web Client for the product I am working on and Mumble uses Opus Codecs. There are other browser compatible libraries out there like "libopus.js" etc but the speed of your library is multi-fold faster than those libs. Can you provide any web version of your library?
I can run your library in browser by turning off wasm i.e. { wasm: false }, but that kills the speed.
I want to use opusscript in my Angular application.
I'm getting the following errors when I start the application
I had previously executed following commands:
In my component ts, I import as:
import OpusScript = require('opusscript');
My tsconfig.json is:
My tsconfig.app.json is:
The index.d.ts in opusscript library has:
What am I missing out here?