Skip to content
Jan Janak edited this page Jan 28, 2021 · 4 revisions
import { PulseAudio } from 'pulseaudio.js';

const pa = new PulseAudio();
await pa.connect();

The client exposes a method called loadModule that can be used to load a module into the PulseAudio server as follows:

const mod = await pa.loadModule('module-null-sink', {
    sink_name       : "my_sink",
    sink_properties : {
        unloadModule : true,
    }
});

The first argument is the name of the PulseAudio module to be loaded. The second (optional) argument contains the command line arguments to be passed to the module, in the form of an object of key=value properties. The method returns an integer identifier of the newly loaded module.

To unload the module, pass the integer identifier to the method unloadModule:

await pa.unloadModule(mod);