Don't use playback rate for state detection

This commit is contained in:
Eduard Urbach 2018-04-20 13:55:49 +02:00
parent bd0182adf4
commit c11690763e

View File

@ -229,7 +229,7 @@ export default class AudioPlayer {
// Add speed
addSpeed(speed: number) {
if(!this.audioNode || this.audioNode.playbackRate.value === 0) {
if(!this.audioNode || this.audioContext.state === "suspended") {
return
}
@ -252,7 +252,7 @@ export default class AudioPlayer {
return
}
if(this.audioNode.playbackRate.value === 0) {
if(this.audioContext.state === "suspended") {
this.resume()
} else {
this.pause()