|
@@ -191,20 +191,20 @@ export default defineComponent({
|
|
if (!audioCtx) {
|
|
if (!audioCtx) {
|
|
audioCtx = new AudioContext()
|
|
audioCtx = new AudioContext()
|
|
source = audioCtx.createMediaElementSource(audioDom)
|
|
source = audioCtx.createMediaElementSource(audioDom)
|
|
|
|
+ analyser = audioCtx.createAnalyser()
|
|
|
|
+ analyser.fftSize = fftSize
|
|
|
|
+ source?.connect(analyser)
|
|
|
|
+ analyser.connect(audioCtx.destination)
|
|
}
|
|
}
|
|
- analyser = audioCtx.createAnalyser()
|
|
|
|
- analyser.fftSize = fftSize
|
|
|
|
- source?.connect(analyser)
|
|
|
|
- analyser.connect(audioCtx.destination)
|
|
|
|
- audioCtx.resume()
|
|
|
|
|
|
+ //audioCtx.resume() // 重新更新状态 加了暂停和恢复音频音质发生了变化 所以这里取消了
|
|
isPause = false
|
|
isPause = false
|
|
requestAnimationFrameFun()
|
|
requestAnimationFrameFun()
|
|
}
|
|
}
|
|
const pauseVisualDraw = () => {
|
|
const pauseVisualDraw = () => {
|
|
isPause = true
|
|
isPause = true
|
|
- audioCtx?.suspend()
|
|
|
|
- source?.disconnect()
|
|
|
|
- analyser?.disconnect()
|
|
|
|
|
|
+ //audioCtx?.suspend() // 暂停 加了暂停和恢复音频音质发生了变化 所以这里取消了
|
|
|
|
+ // source?.disconnect()
|
|
|
|
+ // analyser?.disconnect()
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
playVisualDraw,
|
|
playVisualDraw,
|