mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 00:27:58 +00:00
test if context is AudioContext before trying to resume
This commit is contained in:
parent
fee62e9173
commit
95142d1a6f
1 changed files with 6 additions and 2 deletions
|
@ -39,8 +39,12 @@ export function setContext(context: BaseAudioContext): void {
|
|||
* @example
|
||||
* document.querySelector('#playbutton').addEventListener('click', () => Tone.start())
|
||||
*/
|
||||
export function start(): Promise < void> {
|
||||
return globalContext.resume();
|
||||
export function start(): Promise <void> {
|
||||
if (globalContext instanceof AudioContext) {
|
||||
return globalContext.resume();
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue