it works for me.
regions.on('region-out', (region) => { if (wavesurfer.isPlaying()) { wavesurfer.pause(); } });