Add volume change handling to ASR plugin

- Implemented an event listener for 'video:volumechange' to adjust the gain node's value based on the current volume of the artplayer instance.
- This enhancement ensures that the audio processing reflects the user's volume adjustments in real-time.
This commit is contained in:
Harvey Zack committed 2025-05-25 11:37:06 +08:00
1 parent 826abd8c7d
commit 19756e8224
3 files changed
+10 -1

No files matched your search

@@ -372,6 +372,9 @@ function artplayerPluginAsr(option = {}) {
}
workletLoaded = false;
}
art.on('video:volumechange', ()=>{
if (gainNode) gainNode.gain.value = art.volume;
});
art.on('play', startCapture);
art.on('pause', stopCapture);
art.on('destroy', destroy);