|
|
@ -113,6 +113,10 @@ class Audio extends React.PureComponent { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
togglePlay = () => { |
|
|
|
togglePlay = () => { |
|
|
|
|
|
|
|
if (!this.audioContext) { |
|
|
|
|
|
|
|
this._initAudioContext(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.state.paused) { |
|
|
|
if (this.state.paused) { |
|
|
|
this.setState({ paused: false }, () => this.audio.play()); |
|
|
|
this.setState({ paused: false }, () => this.audio.play()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -131,10 +135,6 @@ class Audio extends React.PureComponent { |
|
|
|
handlePlay = () => { |
|
|
|
handlePlay = () => { |
|
|
|
this.setState({ paused: false }); |
|
|
|
this.setState({ paused: false }); |
|
|
|
|
|
|
|
|
|
|
|
if (this.canvas && !this.audioContext) { |
|
|
|
|
|
|
|
this._initAudioContext(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.audioContext && this.audioContext.state === 'suspended') { |
|
|
|
if (this.audioContext && this.audioContext.state === 'suspended') { |
|
|
|
this.audioContext.resume(); |
|
|
|
this.audioContext.resume(); |
|
|
|
} |
|
|
|
} |
|
|
|