Skip to content
Function

registerFlacEncoder

ts
registerFlacEncoder(): void;

Registers the FLAC encoder, which Mediabunny will then use automatically when applicable. Make sure to call this function before starting any encoding task.

Preferably, wrap the call in a condition to avoid overriding any native FLAC encoder:

ts
import { canEncodeAudio } from 'mediabunny';
import { registerFlacEncoder } from '@mediabunny/flac-encoder';

if (!(await canEncodeAudio('flac'))) {
    registerFlacEncoder();
}

Released under the Mozilla Public License 2.0.