mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33:01 -06:00
Minor improvements to radio.service
This commit is contained in:
parent
73bb1d670d
commit
446f8c9502
|
|
@ -236,20 +236,10 @@ export class AppRadioService implements OnDestroy {
|
|||
this.audioTimer = setInterval(() => this.emitTimeEvent(), 500);
|
||||
|
||||
if (this.audioContext.state === 'suspended') {
|
||||
const resume = () => {
|
||||
this.audioContext.resume();
|
||||
|
||||
setTimeout(() => {
|
||||
if (this.audioContext.state === 'running') {
|
||||
EVENTS.forEach((event) => document.body.removeEventListener(event, resume));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
EVENTS.forEach((event) => document.body.addEventListener(event, resume));
|
||||
this.audioContext.resume();
|
||||
}
|
||||
}
|
||||
}, () => this.skip(true));
|
||||
}, () => this.skip());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -333,13 +323,15 @@ export class AppRadioService implements OnDestroy {
|
|||
} else {
|
||||
this.audioContext = new AudioContext();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.audioContext && this.audioContext.state === 'suspended') {
|
||||
if (this.audioContext) {
|
||||
EVENTS.forEach((event) => document.body.removeEventListener(event, bootstrap));
|
||||
|
||||
if (this.audioContext.state === 'suspended') {
|
||||
this.audioContext.resume();
|
||||
}
|
||||
}
|
||||
|
||||
EVENTS.forEach((event) => document.body.removeEventListener(event, bootstrap));
|
||||
};
|
||||
|
||||
EVENTS.forEach((event) => document.body.addEventListener(event, bootstrap));
|
||||
|
|
|
|||
Loading…
Reference in a new issue