mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 14:41:20 -08:00
fix(asr): [PKG-ASR-07] apply native playback volume only once
This commit is contained in:
1 parent
93208e59e1
commit
3e3bed2b93
19 files changed
+2780
-44
No files matched your search
@@ -12,21 +12,18 @@ export default function artplayerPluginAsr(option: AsrOptions = {}) {
|
||||
throw new Error('Could not create ASR subtitle layer')
|
||||
const subtitles = createSubtitles(layer, length, autoHideTimeout)
|
||||
const capture = new Capture(art.video, { interval, sampleRate, onAudioChunk }, subtitles.append)
|
||||
const volume = () => capture.volume(art.volume)
|
||||
const play = () => capture.start()
|
||||
const pause = () => capture.pause()
|
||||
const restart = () => capture.restart()
|
||||
const stop = () => capture.stop()
|
||||
const destroy = () => {
|
||||
subtitles.destroy()
|
||||
art.off('video:volumechange', volume)
|
||||
art.off('play', play)
|
||||
art.off('pause', pause)
|
||||
art.off('restart', restart)
|
||||
art.off('destroy', destroy)
|
||||
return capture.stop(true)
|
||||
}
|
||||
art.on('video:volumechange', volume)
|
||||
art.on('play', play)
|
||||
art.on('pause', pause)
|
||||
art.on('restart', restart)
|
||||
|
||||
Reference in new issue
Block a user