[]SoundChannel在页面失焦后自动丢失audioBuffer,以致没有声音
页面在焦点时:WebAudioSoundChannel {audioBuffer: AudioBuffer, gain: GainNode, bufferSource: AudioBufferSourceNode, _currentTime: 0, _volume: 1, …}
audioBuffer:AudioBuffer {length: 7364022, duration: 153.417125, sampleRate: 48000, numberOfChannels: 2}
bufferSource:AudioBufferSourceNode {buffer: AudioBuffer, playbackRate: AudioParam, detune: AudioParam, loop: true, loopStart: 0, …}
completeHandler:null
context:AudioContext {baseLatency: 0.01, destination: AudioDestinationNode, currentTime: 3.7706666666666666, sampleRate: 48000, listener: AudioListener, …}
gain:GainNode {gain: AudioParam, context: AudioContext, numberOfInputs: 1, numberOfOutputs: 1, channelCount: 2, …}
isStopped:false
页面失焦后:
WebAudioSoundChannel {audioBuffer: AudioBuffer, gain: GainNode, bufferSource: AudioBufferSourceNode, _currentTime: 0, _volume: 1, …}
audioBuffer:null
bufferSource:null
completeHandler:null
context:AudioContext {baseLatency: 0.01, destination: AudioDestinationNode, currentTime: 200.63733333333334, sampleRate: 48000, listener: AudioListener, …}
gain:GainNode {gain: AudioParam, context: AudioContext, numberOfInputs: 1, numberOfOutputs: 1, channelCount: 2, …}
isStopped:true
audioBuffer:AudioBuffer {length: 7364022, duration: 153.417125, sampleRate: 48000, numberOfChannels: 2}
bufferSource:AudioBufferSourceNode {buffer: AudioBuffer, playbackRate: AudioParam, detune: AudioParam, loop: true, loopStart: 0, …}
completeHandler:null
context:AudioContext {baseLatency: 0.01, destination: AudioDestinationNode, currentTime: 3.7706666666666666, sampleRate: 48000, listener: AudioListener, …}
gain:GainNode {gain: AudioParam, context: AudioContext, numberOfInputs: 1, numberOfOutputs: 1, channelCount: 2, …}
isStopped:false
页面失焦后:
WebAudioSoundChannel {audioBuffer: AudioBuffer, gain: GainNode, bufferSource: AudioBufferSourceNode, _currentTime: 0, _volume: 1, …}
audioBuffer:null
bufferSource:null
completeHandler:null
context:AudioContext {baseLatency: 0.01, destination: AudioDestinationNode, currentTime: 200.63733333333334, sampleRate: 48000, listener: AudioListener, …}
gain:GainNode {gain: AudioParam, context: AudioContext, numberOfInputs: 1, numberOfOutputs: 1, channelCount: 2, …}
isStopped:true
要回复问题请先登录
1 个回复
zodial
赞同来自:
解决方法:Laya.SoundManager.autoStopMusic = false