requireLiteRtLmWebAudioEncoderFor function

Future<void> requireLiteRtLmWebAudioEncoderFor(
  1. LiteRtLmWebEmbedderConfig config
)

requireLiteRtLmWebAudioEncoder for the bundle config names, as describe() runs it before core closes the embedder it holds: the opfs:// path resolved to a blob: URL for the read, and that URL revoked after it, whatever the outcome.

Implementation

Future<void> requireLiteRtLmWebAudioEncoderFor(
  LiteRtLmWebEmbedderConfig config,
) async {
  final url = await _resolveModelUrl(config);
  try {
    await requireLiteRtLmWebAudioEncoder(
      config.runtime,
      url,
      fileName: config.fileName,
    );
  } finally {
    if (config.modelPath.startsWith('opfs://')) config.revokeUrl(url);
  }
}