load method

Opens the WebAssembly opus library contained in this plugin.

Uses DynamicLibrary.open which handles JS injection, Emscripten module compilation, and memory setup. Registers the created memory as global if none is set yet.

Implementation

@override
Future<Object> load() async {
  _library ??= await DynamicLibrary.open(
    './assets/packages/opus_codec_web/assets/libopus.js',
    moduleName: 'libopus',
    useAsGlobal: GlobalMemory.ifNotSet,
  );
  return _library!;
}