load method
Opens the opus shared library.
First attempts to load a bundled binary from Flutter assets (copied to a
temporary directory). If that fails for any reason (missing asset,
unsupported architecture, etc.), falls back to the system-installed
libopus.so.0.
Throws an ArgumentError if neither the bundled nor the system library can be loaded.
Implementation
// coverage:ignore-start
@override
Future<Object> load() async {
try {
final path = await _copyBundledLibrary();
return DynamicLibrary.open(path);
} catch (_) {
try {
return DynamicLibrary.open('libopus.so.0');
} catch (_) {
throw ArgumentError('Failed to load libopus. '
'Neither the bundled library nor the system-installed '
'libopus.so.0 could be opened. '
'Install libopus with: sudo apt install libopus0');
}
}
}