-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly resume AudioContext on iOS platform. #3499
Conversation
src/sound/manager.js
Outdated
const resumeFunction = function () { | ||
this.suspended = false; | ||
this.fire('resume'); | ||
}.bind(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const resumeFunction = function () { | |
this.suspended = false; | |
this.fire('resume'); | |
}.bind(this); | |
const resumeFunction = () => { | |
this.suspended = false; | |
this.fire('resume'); | |
} |
src/sound/manager.js
Outdated
const resumeFunction = function () { | ||
this.suspended = false; | ||
this.fire('resume'); | ||
}.bind(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const resumeFunction = function () { | |
this.suspended = false; | |
this.fire('resume'); | |
}.bind(this); | |
const resumeFunction = () => { | |
this.suspended = false; | |
this.fire('resume'); | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming the above code suggestion works OK. But using the arrow function should avoid the need to use bind
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beat ya! :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, except you deleted the trailing semi-colon, @slimbuck! 😆
I have a minor concern here. There another bug you might want to check out: #2383 |
Calling |
Oh interesting. Yeah, that sounds like a good solution to me. |
Fixes #3212
This PR makes sure that the
AudioContext
is properly resumed on the iOS platform when context is switched by using the AudioContext#resume API. It returns a future, so the callback is only triggered onceAudioContext
is actually resumed. For other platforms, or ifAudioContext
is not being used, the logic is unchanged.According to https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state , iOS Safari sets the state to
interrupted
.I confirm I have read the contributing guidelines and signed the Contributor License Agreement.